丢弃Git Stash Pop [英] Discard Git Stash Pop
问题描述
我做了一个git存储流行,现在我有很多冲突。我已经在 git stash pop
之前提交了所有最近的代码,那么是否有办法返回上次提交并摆脱所有冲突并编写 git stash pop
已注入?
I did a git stash pop and now I have a ton of conflicts. I had committed all my recent code before the git stash pop
, so is there a way to go back to the last commit and get rid of all the conflicts and code the git stash pop
injected?
推荐答案
(请参阅如何将Git存储库恢复到之前的提交?),但简单的答案是:
This has already been asked and answered on stackoverflow (see How to revert Git repository to a previous commit?), but the simple answer is:
git reset --hard HEAD
这应该照顾你的问题。 请注意,这会从存储库中删除所有未提交的更改。
This should take care of your problem. Note that this removes all uncommitted changes from the repository.
请注意,如果存在冲突,则会保留存储空间。从隐藏文档:
Note that if there are conflicts, the stash is preserved. From the stash docs:
应用状态可能会因冲突而失败;在这种情况下,它不是从存储列表中删除
。您需要手工解决冲突
,然后手动调用git stash drop
。
这篇关于丢弃Git Stash Pop的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!