Git过滤器分支表示工作树不是很脏

时间:2011-06-24 05:53:27

标签: git command-line

我正在尝试在我的git存储库中重写我的历史记录,因为我需要删除包含受限信息的文件。

这就是:

$ git filter-branch --index-filter 'git rm --cached --ignore-unmatch FILE' master
Cannot rewrite branch(es) with a dirty working directory.

所以我认为“这很奇怪,我很确定我没有未提交的更改”,我跑了:

$ git status -u
# On branch master
nothing to commit (use -u to show untracked files)

这里发生了什么?有没有人知道会发生什么?这个存储库中有子模块。

子模块暂存信息

我有18个子模块(所有Vim插件),这是他们的状态。认为这可能是有用的信息。

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

其他信息

$ git diff-files --ignore-submodules --quiet
$ echo $?
1
$ git diff-index --cached --quiet HEAD --
$ echo $?
0

1 个答案:

答案 0 :(得分:7)

这主要是猜测,但错误可能是由git v1.7.7.1中的fixed错误引起的(该错误是在原始帖子之后发布的)。来自提交消息:

  

Filter-branch已经要求我们在开始之前有一个干净的工作树。但是,它在检查之前无法刷新索引,这意味着在严重肮脏的情况下它可能是错误的。