Git过滤器分支说,工作树是脏的,当它不是 [英] Git filter-branch says working tree is dirty when it is not

查看:2381
本文介绍了Git过滤器分支说,工作树是脏的,当它不是的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这是发生了什么:

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

  $ git filter-branch --index-filter'git rm --cached --ignore-unmatch FILE'master 
用脏工作目录重写分支。

所以我认为这很奇怪,我确定我没有未提交的更改我运行:

  $ git status -u 
#在分支主机上
无提交-u显示未跟踪的文件)

这是怎么回事?有没有人有什么可能发生的想法?



子模块暂存信息



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

  $ for i in $(ls); do cd $ i; git status -u; cd ..;完成
#当前不在任何分支。
无提交(工作目录clean)
#当前不在任何分支上。
无提交(工作目录clean)
#当前不在任何分支上。
无提交(工作目录clean)
#当前不在任何分支上。
无提交(工作目录clean)
#当前不在任何分支上。
无提交(工作目录clean)
#当前不在任何分支上。
无提交(工作目录clean)
#当前不在任何分支上。
无提交(工作目录clean)
#当前不在任何分支上。
无提交(工作目录clean)
#当前不在任何分支上。
无提交(工作目录clean)
#当前不在任何分支上。
无提交(工作目录clean)
#当前不在任何分支上。
无提交(工作目录clean)
#在分支master上
无提交(工作目录clean)
#当前没有任何分支。
无提交(工作目录clean)
#当前不在任何分支上。
无提交(工作目录clean)
#当前不在任何分支上。
无提交(工作目录clean)
#当前不在任何分支上。
无提交(工作目录clean)
#当前不在任何分支上。
无提交(工作目录clean)
#当前不在任何分支上。
无提交(工作目录清除)



其他信息



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


解决方案

但该错误可能是由固定的错误引起的git v1.7.7.1(它是在您的原始帖子后发布的)。从提交消息:


过滤分支已经要求我们在开始之前有一个干净的工作树。但是,它在检查之前未能刷新索引,这意味着在统计信息的情况下它可能是错误的。



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

解决方案

This is mostly a guess, but the error may be caused by a bug that was fixed in git v1.7.7.1 (which was released after your original post). From the commit message:

Filter-branch already requires that we have a clean work tree before starting. However, it failed to refresh the index before checking, which means it could be wrong in the case of stat-dirtiness.

这篇关于Git过滤器分支说,工作树是脏的,当它不是的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆