4 ms·
You don't need a staging area if you want to just commit selectively. No VCS that I know of will stop you from doing just that if you really want to. bzr/fos
by rbehrends 12y ago
You don't need a staging area if you want to just commit selectively. No VCS that I know of will stop you from doing just that if you really want to.
bzr/fossil/git/hg/mtn/svn commit path1 ... pathn
will selectively commit only the listed files/directories (some of them will even allow you to commit individual hunks, as in "git add -p", if you like to live dangerously).
The biggest problem with the staging area is that (1) it can happen accidentally that you forgot to "git add" a file or (2) it really only gives you any advantage over selective commits when you stage a non-trivial selection of files, which is exactly where things have a chance of going wrong.
- obsurveyor 12y agoWhat am I missing, just --amend the commit with the stuff you forgot? Also, with 'git add -i' you can stage individual hunks of a change instead of the whole change. This can be useful when you need to break up changes into multiple commits. I don't think you can 'git stash' your way out of that situation.