botbotbot 's blog

Avoid git commit -m

Most of Git tutorial even Try Git guide you about git commit with this

$ git commit -m "hello world"

That’s OK. But It better to use any option without -m.

$ git commit
$ git commit -a
$ git commit --amend

Without -m, Git will popup your editor to write the commit message like this

git-commit-vim

It’s more powerful than -m option that limit your commit message to one line, without -m you can write commit message with many line.

It also let your know when the first line exceed 50 characters that is best practice to write commit message.

It provide a list of files which involve in the commit that give your a chance to revise.

If you are Vim fanboy, you should look at fugitive.vim the best Git wrapper that make Vim more powerful with Git, your can watch screencast with fugitive.vim in The Fugitive Series - a retrospective.

How to write better commit message:

Set your git editor