`git commit -a`表明该目录即使在添加后也有未提交的更改

时间:2012-05-09 20:20:18

标签: git

我有以下树:

Staged:  
foo
foo/a.txt  
foo/b.txt  

Unstaged:  
foo/c.txt

如果我git add foo/c.txtgit commit -a我在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/

我害怕有些东西可能会丢失,所以我退出提交并git add -A; git commit然后我在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

这是正常的。

修改

foo/不在我的.gitignorefoo/a.txtfoo/b.txt最初没有上演。我刚刚用git commit -a添加了它们 foo/不是符号链接,文件或其他存储库

为什么foo/最初未显示?我只想在这里保存一些按键。

使问题复杂化,这有时只是可重复的。我正在运行git version 1.7.7.5 (Apple Git-26)

更多编辑

以下命令:

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

在我的编辑器中生成以下状态:

# 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/

0 个答案:

没有答案