was successfully added to your cart.

`git commit -a` considered harmful

By October 6, 2014blog

git commit -am "msg"
The seemingly helpful habit of appending -a (short for “add”), I now consider harmful. -a only stages changes to known files. It does not stage new files. Worse yet, -a squelches error messages about unstaged and untracked files.

git commit -am is therefore a false security blanket. You will be unpleasantly surprised next time you type git status and discover that git hasn’t been tracking your new files.

git commit -m is a much safer habit. That way, git will at least warn you about unstaged and untracked files.

Leave a Reply