I have the following tree:
Staged:
foo
foo/a.txt
foo/b.txt
Unstaged:
foo/c.txt
If I git add foo/c.txt
and git commit -a
I see the following in vi:
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: foo/a.txt
# modified: foo/b.txt
# new file: foo/c.txt
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# foo/
I get scared that something might be missing, so I back out of the commit and git add -A; git commit
and then I see the following in vi:
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: foo/a.txt
# modified: foo/b.txt
# new file: foo/c.txt
Which is normal.
EDIT
foo/
is not in my .gitignore
foo/a.txt
and foo/b.txt
were not originally staged. I just added them with git commit -a
foo/
was not a symlink, file, or another repository
Why does foo/
show up untracked initially? I'm just trying to save some keystrokes here.
To complicate matters, this only sometimes reproducible. I'm running git version 1.7.7.5 (Apple Git-26)
MORE EDIT
The following commands:
git init foo
cd foo
mkdir bar
cd bar
touch 1
touch 2
cd ..
git add -A
git commit
echo 1 >> bar/1
echo 2 >> bar/2
git commit -a
Produce the following status in my editor:
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: bar/1
# modified: bar/2
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# bar/