$ git commit -m "Add email integration on /email route" sounds weird for an activity that has been completed.
$ git commit -m "Add email integration on /email route" sounds weird for an activity that has been completed.
It makes more sense if you consider a commit to be an independent "thing" in a list, and you follow the list from start to finish to end up with the current repository state, each commit being a command.
[0] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.g...
It goes something like this.
"Hmm, I wonder what would happen if I merge 1231knf?"
It would "Add email integration on /email route"
Otherwise it would be something like
"What happens when I merge this commit?"
"Added email integration on /email route"
It's considered as best practice when using Git to write in present tense.
I'm of the mindset a team can be mature enough to pick what works best for them. If the idea of a commit message is to convey useful info, imposing hard rules like 72 chars or tense seems a bit draconian. The worst change GitHub has made IMHO is truncating messages (particularly because the truncated message often ends up longer).
Write your commit message in the imperative: "Fix bug" and not "Fixed bug" or "Fixes bug." This convention matches up with commit messages generated by commands like git merge and git revert.
Why did you 'Add feature...'? Why did you 'Move cursor to...'?
I did stuff // Increment i by 1
Why I did stuff // Increment i by 1 to not have a off by 1 bug
* The big fix: This is the commit which usually is too complex to be explained in a 72-characters message. Usually it refers to an issue number on the project's issue tracker, which in my case is Github.
* The medium fix: This is a commit whose "why" fits properly into 72 characters, i.e. "Add classes to validate user input only on Friday".
* The small/obvious fix: This is a very small commit, usually fixes obvious issues like CI builds, misspellings in doc files, missing semi-colons, etc etc.
In the last case, I find it appropriate to write the "how" rather than the "why" in the commit message, since the why is already obvious. i.e. "Add missing comma on object identifier".
The commit message should say what changed, not why. Comments are for explaining why the code does what it does.
Good commit log: http://git.savannah.gnu.org/cgit/guix.git/commit/?id=fb519bd...
Example comment: i++; // because server starts counting at 0 (not 1)
Example commit: Our customer switched to bar (from foo), which starts counting at 0 instead
This enables you to easily compile release notes, for example.
For larger centralized projects, I have found a requirement on issue numbers in commit messages to work well. It makes a whole lot of management issues easier.
Maybe it's because "Add" is shorter than "Adding" or "Added"? When I first worked on a project that followed the Angular pattern, the guy ramping me up said "Just imagine that you're commanding the computer to do something, and use that tense."
A commit can be seen as a patch, which has a single purpose: "Add...".
What does a commit do? It adds/fixes/breaks, it doesn't added/fixed/broke.