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
filter-branchagain after runninggit status? Maybe only the timestamp of a file changed andfilter-branchdoesn't check for that to remove the dirty flaggit status -ushow? Also have you tried removing any untracked files and or doing this on a completely new clone?