标题所说的一直对我有用,但是我的修改后的文件突然不再被添加了,为什么?
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: ../../core/src/com/pixelscientists/galaxy/bullet/ContactHandler.java
modified: ../../core/src/com/pixelscientists/galaxy/bullet/MyContactListener.java
modified: ../../core/src/com/pixelscientists/galaxy/bullet/handler/ExplorableAreaVsPlayerHandler.java
modified: ../../core/src/com/pixelscientists/galaxy/bullet/handler/LazerShotVsAsteroidHandler.java
modified: ../../core/src/com/pixelscientists/galaxy/bullet/handler/PlayerVsPickupHandler.java
modified: ../../core/src/com/pixelscientists/galaxy/entity/impl/Asteroid.java
Untracked files:
(use "git add <file>..." to include in what will be committed)
textures/earth/
textures/europa2_out.jpg
textures/fog.jpg
textures/fog.png
textures/jupiter-transparent.png
textures/jupiter.jpg
textures/laser.png
no changes added to commit (use "git add" and/or "git commit -a")
git add -u
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: ../../core/src/com/pixelscientists/galaxy/bullet/ContactHandler.java
modified: ../../core/src/com/pixelscientists/galaxy/bullet/MyContactListener.java
modified: ../../core/src/com/pixelscientists/galaxy/bullet/handler/ExplorableAreaVsPlayerHandler.java
modified: ../../core/src/com/pixelscientists/galaxy/bullet/handler/LazerShotVsAsteroidHandler.java
modified: ../../core/src/com/pixelscientists/galaxy/bullet/handler/PlayerVsPickupHandler.java
modified: ../../core/src/com/pixelscientists/galaxy/entity/impl/Asteroid.java
Untracked files:
(use "git add <file>..." to include in what will be committed)
textures/earth/
textures/europa2_out.jpg
textures/fog.jpg
textures/fog.png
textures/jupiter-transparent.png
textures/jupiter.jpg
textures/laser.png
no changes added to commit (use "git add" and/or "git commit -a")
有谁知道可能导致此行为的原因?正如我所说,我之前已经多次这样做,以避免添加大纹理图像。即使git add *
只添加纹理,也不添加我修改过的源文件。怎么可能?
答案 0 :(得分:2)
如果您使用的是git 2.0,那就可以了,就像我在&#34; Difference between “git add -A
” and “git add .
”&#34;中提到的那样。
git add -u
现在(git 2.0,2014年5月)对整个仓库进行操作。
在git 2.0之前,你需要在你的情况下做git add -u ../..
。
请参阅git add
:
如果在使用
<pathspec>
选项时未给出-u
,则会更新整个工作树中的所有跟踪文件。 (旧版本的Git用于限制对当前目录及其子目录的更新)。