Bug: partially staged file is committed in whole, if there is another staged file
- From
- Paul Beckingham <paul@beckingham.net>
- Date
- Aug 17, 2014, 17:05 UTC
- Message-ID
- <96FA86FB-D017-470F-899F-EA0F6F28C1E4@beckingham.net>
If I have two modified files, and file1 is staged (git add file1), and file2 is partially staged (git add -p file2), and then try to commit only the partially staged file2, git commits *all* changes to file2, not just the staged part.
There is no bug without file1 also being staged.
Here is a transcript illustrating the problem:
$ uname -v Darwin Kernel Version 14.0.0: Tue Jul 29 16:22:25 PDT 2014; root:xnu-2782.1.62~4/RELEASE_X86_64
$ git version git version 2.1.0
$ git status -sb ## master M file1 MM file2 $ git commit file2 -m "adding patch" [master 066a6e2] adding patch 1 file changed, 2 insertions(+)
$ git status -sb ## master M file1 $
Regards, Paul