|
| 1 | +# Commit Messages |
| 2 | + |
| 3 | +Commit messages should follow the guidelines in the [GNOME handbook][handbook]. |
| 4 | +Please make sure that you have read those recommendations carefully. |
| 5 | + |
| 6 | +The following outlines the additional conventions that are used |
| 7 | +in gnome-shell (and mutter). |
| 8 | + |
| 9 | +[handbook]: https://handbook.gnome.org/development/commit-messages.html |
| 10 | + |
| 11 | +## Example |
| 12 | + |
| 13 | +``` |
| 14 | +status/volume: Automatically mute in vacuum |
| 15 | +
|
| 16 | +In space, no one can hear you scream. There is no point |
| 17 | +in emitting sound that cannot be perceived, so automatically |
| 18 | +mute all output streams. |
| 19 | +
|
| 20 | +Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/1234 |
| 21 | +``` |
| 22 | + |
| 23 | +## Description |
| 24 | + |
| 25 | +Try to always prefix commit subjects with a relevant topic, such |
| 26 | +as `overview:` or `st/actor:`. Less specific changes can use more |
| 27 | +general topics such as `st` or `js`. |
| 28 | + |
| 29 | +As a general rule, it is always better to write too much in the |
| 30 | +commit message body than too little. |
| 31 | + |
| 32 | +## References |
| 33 | + |
| 34 | +References should always be expressed as full URL instead of the |
| 35 | +`#1234` shorthand, so they still work outside the GitLab UI. |
| 36 | + |
| 37 | +To close an issue automatically, we prefer the `Closes:` keyword |
| 38 | +over the alternatives (see next section). |
| 39 | + |
| 40 | +If a merge requests consists of multiple commits and none of them |
| 41 | +fixes the issue completely, use the plain issue URL without prefix |
| 42 | +as reference, and use the automatic issue closing syntax in the |
| 43 | +description of the merge request. |
| 44 | + |
| 45 | +Do not add any `Part-of:` line, as that will be handled automatically |
| 46 | +when merging. |
| 47 | + |
| 48 | +## The Fixes tag |
| 49 | + |
| 50 | +If a commit fixes a regression caused by a particular commit, it |
| 51 | +can be marked with the `Fixes:` tag. To produce such a tag, use |
| 52 | + |
| 53 | +``` |
| 54 | +git show -s --pretty='format:Fixes: %h ("%s")' <COMMIT> |
| 55 | +``` |
| 56 | + |
| 57 | +or create an alias |
| 58 | + |
| 59 | +``` |
| 60 | +git config --global alias.fixes "show -s --pretty='format:Fixes: %h (\"%s\")'" |
| 61 | +``` |
| 62 | + |
| 63 | +and then use |
| 64 | + |
| 65 | +``` |
| 66 | +git fixes <COMMIT> |
| 67 | +``` |
0 commit comments