Git your act together
jeffkreeftmeijer.com
jeffkreeftmeijer.com
First of all, it allows you to easily write extended commit messages (just leave the second line blank and start writing the extended message on the third line). A good idea would be to leave (#more) anchor at the end of the first line, so that others would know there's actually some more info they might want to read.
Then you can always see the files currently being committed while you're in the editor, that's convenient. Last but not least - it helps me take my commit messages seriously.
git commit -F -
to specify that the commit message should be read from standard input.That doesn't mean that I don't rebase a bunch of those smaller changes away before pushing them upstream it just means a lot of the changes I commit are small enough that it's easier not to load Vim to write a commit message.
Commit messages are important. You should make them fun to read.
> Don’t try to be clever, witty or funny.
I've worked with someone who did sit around thinking what to put in a commit, and believe me, he didn't commit as often as he should have.
I write my fair share of terrible commit messages, too. It always bites me in the ass eventually.
Personally, I like clever commit messages. They remind me that the project was written by humans for humans.
My approach is to add silly things in as fluff, not as the message itself.
The frobnicator now frobnicates.
becomes The frobnicator now frobnicates, omgh4x!!!11
or whatever. Make sure you've got enough _real_ information there, and some light extra whatever is fine.Then again, sometimes, you really need good commit messages: http://github.com/shoes/shoes/commit/95fed5e6310cb0174ba80b8...
I use this all the time for cleaning up topic branches before I push them out.
I use magit.el for Emacs which makes this really easy, and if you screw up getting your data back from the reflog is a lot easier than if you just had a bunch of --amend fixups.
- Multiple changes that affect the same line(s) are very difficult to pick apart.
- It is easier to write a meaningful commit message while the change is fresh in your head; otherwise a lot of time is spent reviewing your changes.
edit: about funny commit messages :-D
> Newsflash: You’re not funny, you’re being an idiot. :)
This is important. Nothing fills me with dread like a commit message that says "fixed NullPointerException in renderer (also a few whitespace changes)".
If one doesn't have bug tracking software to go to and read about why the commit was done, then it should be much more verbose: "Opening files on a select box executed in the wrong thread. Looks like it erred during startup, where we can't yet fork the process. This patch mitigates the selection box during startup by checking to see if we can fork into our proper thread or not. If we can't, we wait until it becomes available."
There is no reason a commit message cannot be a novel unto itself. And something like that will require a period at the end. If you're trying to limit yourself to a single sentence, or something that can be fit into a tweet, you're only hurting yourself.
Once you discover git rebase -i you will never go back!