我正在尝试应用我之前在git stash pop
中隐藏的更改,并得到以下消息:
Cannot apply to a dirty working tree, please stage your changes
对如何处理这个问题有什么建议吗?
发布于 2012-07-24 16:59:03
我是这样做的:
git add -A
git stash apply
然后(可选):
git reset
发布于 2011-04-26 17:09:26
我还发现Mathias Leppich's solution很好用,所以我在我的全局.gitconfig中为它添加了一个别名
[alias]
apply-stash-to-dirty-working-tree = !git stash show -p | git apply && git stash drop
现在我只需要输入
git apply-stash-to-dirty-working-tree
这对我来说很有效。
(您的里程数可能因此长别名而异。但我喜欢bash补全时的冗长。)
发布于 2012-01-21 03:33:59
您可以通过执行git add
来存放您所做的任何更改,从而将stash应用于“脏”树,从而清理树。然后,您可以git stash pop
并应用隐藏的更改,没有问题。
https://stackoverflow.com/questions/1360712
复制相似问题