Aborting a stash pop in Git

后端 未结 14 2045
鱼传尺愫
鱼传尺愫 2020-12-22 17:47

I popped a stash and there was a merge conflict. Unlike the question that is listed as a duplicate, I already had some uncommitted changes in the directory which I wanted to

相关标签:
14条回答
  • 2020-12-22 18:12

    I solved this in a somewhat different way. Here's what happened.

    First, I popped on the wrong branch and got conflicts. The stash remained intact but the index was in conflict resolution, blocking many commands.

    A simple git reset HEAD aborted the conflict resolution and left the uncommitted (and UNWANTED) changes.

    Several git co <filename> reverted the index to the initial state. Finally, I switched branch with git co <branch-name> and run a new git stash pop, which resolved without conflicts.

    0 讨论(0)
  • 2020-12-22 18:13

    Try using if tracked file.

    git rm <path to file>
    git reset  <path to file>
    git checkout <path to file>
    
    0 讨论(0)
提交回复
热议问题