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?

3
  • 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. Commented Jun 6, 2014 at 5:46
  • You should write that as an aster and mark it answered- score a badge for answering your own question ;-) Commented Jun 6, 2014 at 5:47
  • @mifi79: Not this time, VonC was too fast :) Commented Jun 6, 2014 at 5:53

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.