|
1 |
| -# gitChangeLog |
2 |
| -Generate a changelog from git commits of the local repository |
| 1 | +# gitChangelog |
| 2 | + |
| 3 | +[](https://github.com/DigiLive/gitChangelog/releases) |
| 4 | +[](https://opensource.org/licenses/BSD-3-Clause) |
| 5 | +[](https://www.codacy.com/gh/DigiLive/gitChangelog/dashboard?utm_source=github.com&utm_medium=referral&utm_content=DigiLive/gitChangelog&utm_campaign=Badge_Grade) |
| 6 | + |
| 7 | +Generate a changelog from git commits of the local repository. |
| 8 | + |
| 9 | +This library parses information which is stored in the Git directory in which it is currently located. With this |
| 10 | +information, it generates a changelog which can be saved into a file. |
| 11 | + |
| 12 | +Check out this [example](CHANGELOG.md) which is actually the changelog of this repository. |
| 13 | + |
| 14 | +If you have any questions, comments or ideas concerning this library, Please consult |
| 15 | +the [Wiki](https://github.com/DigiLive/gitChangelog/wiki) at first. Create a |
| 16 | +new [issue](https://github.com/DigiLive/gitChangeLog/issues/new) is your concerns remain unanswered. |
| 17 | + |
| 18 | +## Features |
| 19 | + |
| 20 | +### Main |
| 21 | + |
| 22 | +- List Tags and their date. |
| 23 | +- List unique commit subjects per tag/release. |
| 24 | +- List commit hashes per unique subject (optional). |
| 25 | +- Include commit subjects (and hashes) of the HEAD revision (E.g. Unreleased changes). |
| 26 | +- Append the content of another file (E.g. An already existing changelog). |
| 27 | +- Save the content of the (appended) changelog to file. |
| 28 | + |
| 29 | +### Other |
| 30 | + |
| 31 | +- Set a From- and To tag to limit the changelog. |
| 32 | +- Filter subjects by labels. |
| 33 | +- Set a header for the changelog (E.g. a title). |
| 34 | +- Set a custom subject for the HEAD revision. |
| 35 | +- Set a custom date for the HEAD revision (E.g. Next Tag/Release date). |
| 36 | +- Set a custom message to indicate there are no commits present. |
| 37 | +- In- or exclude merge commits. |
| 38 | +- Define a custom format for Tag/Release lines. |
| 39 | +- Define a custom format for subject lines. |
| 40 | +- Define a custom format for hash lines. |
| 41 | + |
| 42 | +### Planned |
| 43 | + |
| 44 | +- Allow sorting tags by other keys than creator date. |
| 45 | +- Allow sorting subjects by labels. |
| 46 | +- Set sort order of tags and subjects. |
| 47 | + |
| 48 | +## Installation |
| 49 | + |
| 50 | +The preferred method is to install the library with [Composer](http://getcomposer.org). |
| 51 | + |
| 52 | +```sh |
| 53 | +> composer require digilive/git-changelog:^1 |
| 54 | +``` |
| 55 | + |
| 56 | +Alternatively you can download the latest release from [Github](https://github.com/DigiLive/gitChangelog/releases). |
| 57 | + |
| 58 | +## Example use |
| 59 | + |
| 60 | +```php |
| 61 | +<?php |
| 62 | + |
| 63 | +use DigiLive\GitChangeLog\GitChangeLog; |
| 64 | + |
| 65 | +// Instantiate composer's auto loader. |
| 66 | +require __DIR__ . '/../vendor/autoload.php'; |
| 67 | + |
| 68 | +// Or include the library manually. |
| 69 | +// require_once 'Path/To/GitChangeLog.php'; |
| 70 | + |
| 71 | +// Instantiate the library. |
| 72 | +$changelog = new GitChangeLog(); |
| 73 | +// Build and save the changelog with all defaults. |
| 74 | +$changelog->build(); |
| 75 | +$changelog->save('CHANGELOG.md'); |
| 76 | +``` |
| 77 | + |
| 78 | +## Notes |
| 79 | + |
| 80 | +- Most settings can be changed directly by setting a public property. |
| 81 | + **(Setting a value of an invalid type, might result in unexpected results.)** |
| 82 | +- The From- and To tags, have to be set by calling a method, because they're validated. |
| 83 | +- Labels must be set by methods also to avoid overhead when adding the same label multiple times. |
| 84 | + |
| 85 | +## Commit guidelines |
| 86 | + |
| 87 | +In order to suitable a good changelog, you should follow the following guidelines: |
| 88 | + |
| 89 | +- Commit messages must have a subject line and may have body copy. |
| 90 | + These must be separated by a blank line. |
| 91 | +- The subject line must not exceed 50 characters. |
| 92 | +- The subject line should be capitalized and must not end in a period. |
| 93 | +- The subject line must be written in an imperative mood (Fix, not Fixed / Fixes etc.). |
| 94 | +- The body copy must be wrapped at 72 columns. |
| 95 | +- The body copy must only contain explanations as to what and why, never how. The latter belongs in documentation and |
| 96 | + implementation. |
0 commit comments