Somehow, git got it in its head that I have an untracked file (A directory that has been in my repository for quite some time, ~17 months). At any rate, I can\'t seem to con
I had the same error: no case changes, no .ignore problems and the directory did contain files that I definitely wanted to keep. Adding the dir, committing, git add -A
and other remedies did not have any effect.
I ended up deleting the directory with "git clean" and then checking out the files inside the dir again.
Here is what I did:
rex@sidekick> git status
# On branch master
# Your branch is ahead of 'origin/master' by 10 commits.
#
# Untracked files:
# (use "git add ..." to include in what will be committed)
#
# app/models/xSpecific/
nothing added to commit but untracked files present (use "git add" to track)
At this point I made a backup copy of the "xSpecific" directory just in case. Then I made a dry run with ´git clean´ (the -n option means "dry run" and -d makes clean remove directories):
rex@sidekick> git clean -n -d
Would remove app/models/xSpecific/
After double and triple checking, I went ahead with the cleaning (the -f flag means "force" and is needed to persuade Git that you are serious. Very good design, if you ask me):
rex@sidekick> git clean -d -f
Removing app/models/xSpecific/
rex@sidekick> git status
# On branch master
# Your branch is ahead of 'origin/master' by 10 commits.
#
# Changed but not updated:
# (use "git add/rm ..." to update what will be committed)
# (use "git checkout -- ..." to discard changes in working directory)
#
# deleted: app/models/xSpecific/GetAddressesLog.java
# deleted: app/models/xSpecific/GetProductLog.java
#
no changes added to commit (use "git add" and/or "git commit -a")
So far, so good. The directory was no longer listed, but the files were of course gone too. I could have restored them from my backup, but this is what Git was made for:
rex@sidekick> git checkout -- app/models/xSpecific/GetAddressesLog.java
rex@sidekick> git checkout -- app/models/xSpecific/GetProductLog.java
rex@sidekick> git status
# On branch master
# Your branch is ahead of 'origin/master' by 10 commits.
#
nothing to commit (working directory clean)
Time to celebrate! Actually, it would probably have been easier to just clone off a new copy of the repository and use that instead, but by doing it the hard way I learned something new :).