我有以下树:
Staged:
foo
foo/a.txt
foo/b.txt
Unstaged:
foo/c.txt
如果我git add foo/c.txt
和git 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/
不在我的.gitignore
中
foo/a.txt
和foo/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/