Git Commit Template
At work we've been moving toward standardized Git commit messages. By following the pattern, it's very easy to see what type of code is in a specific commit.
We use Sprint.ly and Github. Both of these services can perform actions based on what is in a commit message. Github can close or reference an issue if I type
closes #144 at the end of my commit. Sprint.ly can pull a commit message into a specific ticket in much the same way.
The problem with all this, is remembering to actually do it in the heat of the moment, when I'm buried in code and trying to push stuff out the door. That's why I put together a Git commit message template. All my template does is list the various flags and an example of how to reference a Sprint.ly ticket, but it shows this in my editor every time I commit. It's been incredibly useful.
Add your own template
- Create a file to hold your template, e.g.
git-commit-template.txt. Put in whatever you want to remember, just be sure to keep everything commented out (via #) or it will be in the actual message.
git config --global commit.template /path/to/git-commit-template.txtor edit
template = /path/to/.gitmessage.txtunder the