Intermittent git error: "Cannot rebase: You have unstaged changes."

Intermittent git error: "Cannot rebase: You have unstaged changes."

我看到很多间歇性的 git 错误,当更改到或变基分支时。有时它会告诉我我不能更改分支,因为它会与未暂存的更改发生冲突,即使我的分支是干净的(git status 显示 "nothing to commit, working directory clean")。如果我再次尝试相同的命令,它会第二次起作用。同样,我有一个命令来重新定位我所有的分支:

'for i in $(git br | grep -e "\srf-"); do git co $i; git rebase master || break; done; git co master'

很多时候它会在中间中断说:

Cannot rebase: You have unstaged changes.
Please commit or stash them.

当我运行 git status,又是"nothing to commit, yada yada"。如果我再次 运行 命令,它会起作用,或者最终会在不同的分支上中断。 运行 有几次它最终会在没有我任何干预的情况下通过所有这些。当我在任何地方都没有未暂存的更改时,为什么我会不断收到这些类型的错误消息?似乎 git 之前处理的任何操作都没有完成,所以如果是这样的话,我想知道是否有办法明确等待它完成。

我发现了一个 couple of other 类似的问题,但它看起来对其他人来说是一致的,而对我来说却不是。如果我再试一次,命令最终会通过。

git版本:1.9.1

OS:Linux Mint,内核:3.16.0-38-generic

这似乎是因为 git 存储库存储在 Dropbox 文件夹中。当我在 Dropbox 上暂停同步时,一切似乎都干净利落地重新定位。