2

What the title says has always worked for me, however suddenly my modified files are not being added anymore, why?

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")

Does anyone know what might cause this behaviour? As I said, I've done it like this several times before to avoid the big textures images being added. Even a git add * adds only the textures, but not my modified source files. How is that possible?

noone
  • 19,520
  • 5
  • 61
  • 76
  • 1
    As soon as I wrote this question, I found the answer myself. I was in a subdirectory (the one with the textures). `git status` seems to show me all changes on the whole tree, so I didn't notice that I was in a subpath. But `git add` seems to only work on the subdirectoy I'm in, and thus not adding the source files which were in another part of the directory tree. – noone Jun 06 '14 at 05:46
  • You should write that as an aster and mark it answered- score a badge for answering your own question ;-) – mifi79 Jun 06 '14 at 05:47
  • @mifi79: Not this time, VonC was too fast :) – noone Jun 06 '14 at 05:53

1 Answers1

2

If you were using git 2.0, that would have worked, as I mentioned in "Difference between “git add -A” and “git add .".

git add -u would now (git 2.0, May 2014) operate on the entire repo.

Before git 2.0, you would need to do a git add -u ../.. in your case.

See git add:

If no <pathspec> is given when -u option is used, all tracked files in the entire working tree are updated
(old versions of Git used to limit the update to the current directory and its subdirectories).

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250