Atom – Git commit messages
atom.io
atom.io
$ git commit -m "Add email integration on /email route" sounds weird for an activity that has been completed.
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).
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."
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.
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...
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.
What does a commit do? It adds/fixes/breaks, it doesn't added/fixed/broke.
A commit can be seen as a patch, which has a single purpose: "Add...".
Or:
Please consider using these emoji, but please don't anticipate or expect other developers will have any idea what their usage means.
Fine with that, but please also write longer descriptive commit messages. For example:
> git log -1 3b5bb1501ce7af8f857af7621fc0d5f86fb4fa93
commit 3b5bb1501ce7af8f857af7621fc0d5f86fb4fa93
Author: Ben Ogle <ogle.ben@gmail.com>
Date: Tue Jan 6 17:09:59 2015 -0800
:lipstick:
Tells me nothing. Nothing! At a glance the commit messages for the atom repo are poor: atom > git-mean-commit-message-bytes | grep '>'
>ALL 147
You would hope github and git users would grok the power of git's commit messages, but hey ho..."improving the format/structure of the code"
So I guess this code just changes spaces or something like that, I don't know I'm just reading what they do, they might do something else, I'm just following the instructions that everyone contributing to the code should.
:lipstick:
I would be tempted to revert the commit because the message tells me nothing about why the change was made. A commit message should be future proofed, even if the code it relates to can never be.The principle is that formatting is orthogonal to other work and therefore shouldn't be mixed in. Unless you do something wrong, formatting changes are harmless so they can be scanned past by someone reviewing a changelog.
Here's a good discussion of the practice on StackOverflow: http://stackoverflow.com/questions/2214480/committing-when-c...
Therein lies the rub; when something goes wrong i want a commit message that explains why that formatting change was made.
:lipstick: - add missing # char, as per conventions
Would have taken all of 5 extra seconds to write and is a lot better future proofed. Remember, a commit message should explain why something changed and not just what changed.I'd accept showing icons when certain commit/commit message criteria are met, for example "refactoring" in commit message or perhaps whitespace commit would trigger the lipstick icon. But putting :lipstick: as the first word in your commit message? What user davexunit said.
However, encoding them as ASCII strings such as ":lipstick:" is not, and that ASCII string is what goes into the commit message. git will not decode these messages as the emoji characters, as far as I know, and I expect that Linus Torvalds would have some choice words if that were a feature request.
Sequences such as ":lipstick:" are a hack to work around the fact that PCs (as opposed to phones and tablets) are bad at both inputting and displaying emoji.
https://github.com/angular/angular.js/blob/master/validate-c...
The format they enforce is here - https://github.com/angular/angular.js/blob/master/validate-c...
If done right then these tags can be invaluable when using tools like `git-bisect` - you can safely ignore the ones marked `docs` or `style` (assuming you are not working with a language like Python).
Not to mention you can build automation around like, for e.g. automatically generating release notes.
[0] https://github.com/erlang/otp/wiki/Writing-good-commit-messa...
Agreed.
>Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
Agreed.
>Limit the first line to 72 characters or less
Agreed.
>Reference issues and pull requests liberally
Agreed.
>Consider starting the commit message with an applicable emoji
Fuck off. This is completely useless and doesn't deserve 14 examples when the above sensible directions are so brief.
The emojii are just shorthands for [CodeImprovement], [Feature], or whatever you might otherwise tag commits as.
IMHO the tags are a quick way to filter commits by each of those. The images are just for quicker reference.
Most projects already use tags like "FIX" "CHANGE" "NEW" etc etc, there really is no reason to use ambiguous emojis.
It's an exaggeration for effect (the downvote effect, I suppose), but recommending emoji as a commit log guideline is totally silly. I cannot take this document seriously.
Really? Downvotes without a response? Seems awfully cowardly. So I'll just assume the performance has improved to the point that opening a large file doesn't cause it to lockup for an hour? Because that seems a lot more important to me than emoji's for commits...
*nope, just tried it again, performance still blows.
Editing your comments to attack people that downvoted you is only going to make the situation worse. Just face the fact that it probably wasn't a good comment and move on.