命令行-Git过滤器分支表示工作树是脏的,而不是



我正试图在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

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

Filter分支已经要求我们在开始之前有一个干净的工作树。然而,它在检查之前未能刷新索引,这意味着在stat脏的情况下它可能是错误的。

最新更新