4

.git-commit-template.txt

 1 year ago
source link: https://gist.github.com/Linell/bd8100c4e04348c7966d
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Author

Linell commented on Feb 12, 2015

curl https://gist.githubusercontent.com/Linell/bd8100c4e04348c7966d/raw/37c1f07f864587a01eb051dc38264267f4a840df/.git-commit-template.txt >> ~/.git-commit-template.txt

git config --global commit.template ~/.git-commit-template.txt

Can you explain or give more examples of "body should be imperative tone".

[Edit: googled around and found this: http://stackoverflow.com/questions/3580013/should-i-use-past-or-present-tense-in-git-commit-messages]

Author

Linell commented on Jun 18, 2015

@somazx I'm sorry, I just saw your comment.

But yeah, I think this answer on that question sums it up very well:

The use of the imperative, present tense is one that takes a little getting used to. When I started mentioning it, it was met with resistance. Usually along the lines of “The commit message records what I have done”. But, Git is a distributed version control system where there are potentially many places to get changes from. Rather than writing messages that say what you’ve done; consider these messages as the instructions for what applying the commit will do. Rather than having a commit with the title:

Renamed the iVars and removed the common prefix.

Have one like this:

Rename the iVars to remove the common prefix

Which tells someone what applying the commit will do, rather than what you did. Also, if you look at your repository history you will see that the Git generated messages are written in this tense as well - “Merge” not “Merged”, “Rebase” not “Rebased” so writing in the same tense keeps things consistent. It feels strange at first but it does make sense (testimonials available upon application) and eventually becomes natural.

Having said all that - it’s your code, your repository: so set up your own guidelines and stick to them.

If, however, you do decide to go this way then git rebase -i with the reword option would be a good thing to look into.

Author

Linell commented on May 14, 2019

It's been a long time since I made this but the only thing I've changed functionally is that I no longer bother with the (<scope>) portion because, if you're writing decent messages, that should be pretty obvious from your message as a whole and that helps ensure you're able to write a good subject line without using too many characters.

It's also worth noting that, while the template specifically mentions JIRA, Github issues work exactly the same way. You can do it via something as simple as:

Fixes #1001

to close issue number 1001.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK