首页  编辑  

解决git stash pop冲突但又不提交

Tags: /计算机文档/Linux & Unix/   Date Created:

How to resolve git stash conflict without commit?

https://intellipaat.com/community/14341/how-to-resolve-git-stash-conflict-without-commit

如果在git 中stash了本地修改,然后git pull,之后合并出现冲突,此时会导致问题,解决冲突后保存了,此时做不了其他git操作,例如pull,如何做到解决冲突又不需要commit?

Let us do what Git suggests without performing any useless commits:

  1. Resolve the conflict(s) manually or using some merge tool.
  2. Then use git reset to mark conflict(s) as resolved and unstage the changes. Also you can execute it without any parameters and Git will remove everything from the index. You don't have to execute git add before.
  3. Finally, remove the stash with git stash drop, because Git doesn't do that on conflict.

Translated to the command-line,下面是操作代码:

$ git stash pop

# ...resolve conflict(s)

$ git reset

$ git stash drop