git add-u不添加修改过的文件

git add-u不添加修改过的文件,git,Git,标题所说的一直对我有用,但是突然间我修改的文件不再被添加了,为什么 git状态 分支主机上的 未为提交而暂存的更改: (使用“git add…”更新将提交的内容) (使用“git签出--…”放弃工作目录中的更改) 修改:../core/src/com/pixelsciets/galaxy/bullet/ContactHandler.java 修改:../core/src/com/pixelsciets/galaxy/bullet/MyContactListener.java 修改:../core

标题所说的一直对我有用,但是突然间我修改的文件不再被添加了,为什么

git状态

分支主机上的

未为提交而暂存的更改:
(使用“git add…”更新将提交的内容)
(使用“git签出--…”放弃工作目录中的更改)
修改:../core/src/com/pixelsciets/galaxy/bullet/ContactHandler.java
修改:../core/src/com/pixelsciets/galaxy/bullet/MyContactListener.java
修改:../core/src/com/pixelsciets/galaxy/bullet/handler/ExplorableAreaVsPlayerHandler.java
修改:../core/src/com/pixelsciets/galaxy/bullet/handler/lazershotvsasterhandler.java
修改:../core/src/com/pixelsciets/galaxy/bullet/handler/PlayerVsPickupHandler.java
修改:../core/src/com/pixelsciets/galaxy/entity/impl/Asteroid.java
未跟踪的文件:
(使用“git add…”包含在将提交的内容中)
纹理/地球/
纹理/europa2_out.jpg
纹理/fog.jpg
纹理/fog.png
纹理/jupiter-transparent.png
纹理/jupiter.jpg
纹理/laser.png
未向提交添加任何更改(使用“git add”和/或“git commit-a”)
git添加-u

git状态

分支主机上的

未为提交而暂存的更改:
(使用“git add…”更新将提交的内容)
(使用“git签出--…”放弃工作目录中的更改)
修改:../core/src/com/pixelsciets/galaxy/bullet/ContactHandler.java
修改:../core/src/com/pixelsciets/galaxy/bullet/MyContactListener.java
修改:../core/src/com/pixelsciets/galaxy/bullet/handler/ExplorableAreaVsPlayerHandler.java
修改:../core/src/com/pixelsciets/galaxy/bullet/handler/lazershotvsasterhandler.java
修改:../core/src/com/pixelsciets/galaxy/bullet/handler/PlayerVsPickupHandler.java
修改:../core/src/com/pixelsciets/galaxy/entity/impl/Asteroid.java
未跟踪的文件:
(使用“git add…”包含在将提交的内容中)
纹理/地球/
纹理/europa2_out.jpg
纹理/fog.jpg
纹理/fog.png
纹理/jupiter-transparent.png
纹理/jupiter.jpg
纹理/laser.png
未向提交添加任何更改(使用“git add”和/或“git commit-a”)

有人知道这种行为的原因吗?正如我所说,我以前多次这样做,以避免添加大纹理图像。即使是
git add*
也只添加纹理,而不添加我修改过的源文件。这是怎么可能的呢?

如果您使用的是Git2.0,正如我在“”中提到的那样,这是可行的

git add-u
现在(git 2.0,2014年5月)将对整个回购进行操作

在Git2.0之前,您需要在本例中执行一个
git add-u../.

见:

如果使用
-u
选项时未给出
,则整个工作树中的所有跟踪文件都将更新
(Git的旧版本用于限制对当前目录及其子目录的更新)


我一写下这个问题,就自己找到了答案。我在一个子目录中(有纹理的那个)
git status
似乎显示了整个树上的所有更改,所以我没有注意到我在一个子路径中。但是,
git add
似乎只对我所在的子目录有效,因此无法添加目录树另一部分中的源文件。您应该将其作为aster编写,并将其标记为已回答-为回答您自己的问题获得徽章;-)@mifi79:这次不是,VonC太快了:)
 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")
 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")