Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I add new folder (actually I cloned it from another repo, and forgot that), then I did some changes there. Additionally I did a lot of changes in another places, when I tried to do git add

# 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)
#   (commit or discard the untracked or modified content in submodules)
#   modified:   protected/ext/SpecificFolder (modified content)

Then I remember that maybe there was .git folder (because previous I did git clone there). I went to that folder and remove non needed files (folders) and .git folder too. I checked git status, nothing strange. Then commit and checkout to another branch and suddenly I figure out that this folder was not added to last commit. Actually folder was added but files inside was ignored. Now even when I'm trying to do git add for that folder nothing happenning and git status do not show any changes :(

What can I do ?

share|improve this question
In case anyone else ends up on this page with the problem I faced: I wasn't able to add files in a sub-folder to Git. Later I found that that sub-folder had its own .git repository and files were getting added to that repository instead of the repository in the main folder. Even in the Git GUI, that sub-folder appeared as a file instead of as a folder. – Nav Jul 18 '14 at 3:26
Thanks. This helped me -- you should add as an answer! – trpt4him Nov 24 '14 at 21:51

Git doesn't track directories; but just the files within them.

It sounds like you might have an ignore pattern that is causing add to do nothing. You can see ignored files with git status --ignored; they can then be tracked with git add --force protected/ext/SpecificFolder

share|improve this answer
No it's not presen in git status --ignored, somehow I'm thinking it is connected with submodule – user1016265 Apr 16 '13 at 18:36
Yep that page helped, it was happend because it was as submodule, I removed it and add as usual folder. Solved – user1016265 Apr 16 '13 at 18:43
This command was a life-saver. Without it, I would've never figured out which directory was ignored. – Igor G. Jun 5 '15 at 15:25

Git doesn't track EMPTY directories. If you have a project w/ multiple layers of subdirectories, git does in fact track the directories w/ files in them. If it didn't, then it would be one flat repository of files.

share|improve this answer

I append to do exactly what this user did : Add an existing git repository inside another one. the symptom was that git recognised that directory as a file, and thus was unable to add the directory's files. Do solve that question, i deleted the .git folder in the folder, moved that folder in another directory, cleared the index, removed the directory where in my repo, and then i was able to add the directory properly. The moral of this is : don't add a repository inside another one.

share|improve this answer
It can also be fixed by running git rm --cached path_to_submodule – Victor Marchuk Jan 15 at 11:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .