Discard Git Stash Pop

前端 未结 3 1703
星月不相逢
星月不相逢 2021-01-31 00:49

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 commi

3条回答
  •  清歌不尽
    2021-01-31 01:12

    Reset can also be called on specific files :

    git reset HEAD ...
    

    You can't hard reset a file though. But you can revert the changes with checkout afterwards :

    git checkout -- ...
    

    You stash will be preserved, as pointed out by Luke in MichaelMilom answer.

    This is useful when you don't want to lose your un-committed local changes.

提交回复
热议问题