I'm trying to rewrite my history in my git repository because I need to remove a file that contains restricted information.
This is what happens:
$ git filter-branch --index-filter 'git rm --cached --ignore-unmatch FILE' master
Cannot rewrite branch(es) with a dirty working directory.
So I think "that's weird, I'm pretty sure I don't have uncommitted changes", and I run:
$ git status -u
# On branch master
nothing to commit (use -u to show untracked files)
What is going on here? Does anyone have an idea for what could be happening? There are submodules in this repository.
Submodule Staging Info
I have 18 submodules (all Vim plugins), and here are their statuses. Thought this might be useful info.
$ for i in $(ls); do cd $i; git status -u; cd ..; done;
# Not currently on any branch.
nothing to commit (working directory clean)
# Not currently on any branch.
nothing to commit (working directory clean)
# Not currently on any branch.
nothing to commit (working directory clean)
# Not currently on any branch.
nothing to commit (working directory clean)
# Not currently on any branch.
nothing to commit (working directory clean)
# Not currently on any branch.
nothing to commit (working directory clean)
# Not currently on any branch.
nothing to commit (working directory clean)
# Not currently on any branch.
nothing to commit (working directory clean)
# Not currently on any branch.
nothing to commit (working directory clean)
# Not currently on any branch.
nothing to commit (working directory clean)
# Not currently on any branch.
nothing to commit (working directory clean)
# On branch master
nothing to commit (working directory clean)
# Not currently on any branch.
nothing to commit (working directory clean)
# Not currently on any branch.
nothing to commit (working directory clean)
# Not currently on any branch.
nothing to commit (working directory clean)
# Not currently on any branch.
nothing to commit (working directory clean)
# Not currently on any branch.
nothing to commit (working directory clean)
# Not currently on any branch.
nothing to commit (working directory clean)
Other info
$ git diff-files --ignore-submodules --quiet
$ echo $?
1
$ git diff-index --cached --quiet HEAD --
$ echo $?
0
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…