我对文件进行了更改。尝试暂存文件后git add
(像往常一样)我继续承诺git commit -m
。然而,终端向我吐出了这样的信息:
no changes added to commit (use "git add" and/or "git commit -a")
我检查了git status
:
#On branch master
#Changes not staged for commit:
#(use "git add <file>..." to update what will be committed)
#(use "git checkout -- <file>..." to discard changes in working directory) modified: ../../Round 1/R1C3/R1C3.py
在对管子进行一番搜索后,我发现我可以以各种其他方式暂存文件,但不能使用git add
没有旗帜。我可以使用git add -A
or git add -u
或使用交互式舞台的舞台。
很困惑,不太明白为什么我的注册git add
不起作用,我伪造了使用git add -A
。故事变得很奇怪。重新启动我的机器(运行 Mavericks 的 2011 Macbook Air)后,我尝试了很好的方法git add
经过一些更改后再次在同一个文件上......你猜怎么着?有效。所以我继续前进。
现在,不久之后,我又遇到了同样的问题。git add
将不起作用(同一目录)。
有谁知道我做错了什么?由于上述替代方案,这并不是一个真正的大问题,但我想了解为什么会发生这种情况。特别是因为这在过去一直对我有用,但现在,它坏了:(
**注意:我计算机上的其他版本控制项目似乎不受影响。
git add R1C3.py
git status
#On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: ../../Round 1/R1C3/R1C3.py
# no changes added to commit (use "git add" and/or "git commit -a")
git add -A
git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: ../../Round 1/R1C3/R1C3.py
#