Undoing accidental git stash pop

前端 未结 3 686
隐瞒了意图╮
隐瞒了意图╮ 2021-01-29 23:34

I stashed some local changes before doing a complicated merge, did the merge, then stupidly forgot to commit before running git stash pop. The pop created some pro

3条回答
  •  旧巷少年郎
    2021-01-29 23:57

    If your merge was not too complicated another option would be to:

    1. Move all the changes including the merge changes back to stash using "git stash"
    2. Run the merge again and commit your changes (without the changes from the dropped stash)
    3. Run a "git stash pop" which should ignore all the changes from your previous merge since the files are identical now.

    After that you are left with only the changes from the stash you dropped too early.

提交回复
热议问题