Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> 1) I don't think providing the message (-m) on the command line is a good habit for beginners.

Why? I started that way and still do it today. Is it considered a bad practice?



Because it doesn't put you in the right mindset.

A commit message should be formatted like an email to your past self, or your future collaborators. It should have a very descriptive and concise title (the first line of the message) written in the present tense and after a line break you should (when necessary) write an email style explanation of the reasoning behind the commit.

If you fixed something, is there context that should be useful for someone discovering this commit in a vacuum. Are there any related commits? If you added something, why? There is so much useful information that can be encoded in a commit message and discovered when someone does a `git blame` for example.

Caleb Thompson wrote a nice concise post on this: http://robots.thoughtbot.com/5-useful-tips-for-a-better-comm...


I'll agree that being in interactive editor is a more conducive setting for this kind of message, but you can provide both a title and longer description via command line by specifying the -m option twice, e.g.

    git commit -m "fixed the widget factory" -m "It seems like we keep getting wooden shoes stuck in the machine, so I added a ShoeClearingDaemon process to check periodically and restart the machine if necessary."




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: