Actually undo git stash pop

前端 未结 4 2123
迷失自我
迷失自我 2021-02-13 15:16

This question had the same title but it is NOT the same question. That question is really asking \"Discard results of git stash pop\". This question is actually

4条回答
  •  眼角桃花
    2021-02-13 15:40

    In your example, to restore to the state before git stash pop, use:

    git reset --hard bar
    

    This form of the git reset command restores the state of the index and the working directory to the head of the bar branch.

    Because you had conflicts on the first git stash pop, the stash remains on the top of the stash stack.

    From there, you can git checkout foo and git stash pop again.

提交回复
热议问题