git subtree pull表示工作树有修改,但git状态表明它没有修改。是什么赋予了? [英] git subtree pull says that the working tree has modifications, but git status says it doesn't. What gives?

查看:1385
本文介绍了git subtree pull表示工作树有修改,但git状态表明它没有修改。是什么赋予了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在我的一个仓库中这样做:

If I do this in one of my repositories:

git subtree pull --prefix=frameworks/AquaticPrime --squash AquaticPrime

我得到这个:

I get this:

Working tree has modifications.  Cannot add.

如果我这样做(当然是在同一个地方):

If I do this (in the same place, of course):

git status

我得到这:

I get this:

# On branch master
nothing to commit (working directory clean)

我不太确定这里发生了什么。 git status命令意味着我没有修改,所以我假设git子树拉是指在与子树相关的不同分支中的修改,但它并不完全清楚。

I'm not quite sure what's going on here. The git status command implies that I don't have modifications, so I'm assuming that the git subtree pull is referring to modifications in a different branch related to the subtree, but it's not entirely clear.

任何人都可以提供启发吗?

Can anyone provide enlightenment?

推荐答案

我刚刚有同样的问题。
从GIT源代码中,当命令 git diff-index HEAD 返回结果时会抛出错误,即使 git status 说工作树是干净的。

I just had the same problem. From GIT source, error is thrown when command git diff-index HEAD returns result, even if git status says working tree is clean.

为了避免这个错误,在我的情况下,我重新签出工作树的当前分支,并且一切似乎都正常: git checkout< branch>

To avoid this error, in my case, I re-checkout the current branch of working tree , and everything seems OK : git checkout <branch>

这有点困惑,但如果有人可以解释为什么...

It's a bit confused, but if someone can explain why ...

这篇关于git subtree pull表示工作树有修改,但git状态表明它没有修改。是什么赋予了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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