I noticed the following suprising behavior:

% git --version
git version 2.10.0

% git add bar
% git status -s 
A  bar
 M foo

% git commit -p foo
[stage a hunk]
# Explicit paths specified without -i or -o; assuming --only paths...
# On branch master
# Changes to be committed:
#       new file:   bar
#       modified:   foo

So why does it want to commit bar too, when I explicitly wanted to
commit foo only?

This is not how "git commit files..." works, and the man page says

            3.by listing files as arguments to the commit command, in which
           case the commit will ignore changes staged in the index, and
           instead record the current content of the listed files (which must
           already be known to Git);

I'd expect "git commit -p files..." to work like
"git add -p files... && git commit files...".

Christian Neukirchen  <chneukirc...@gmail.com>  http://chneukirchen.org

Reply via email to