Undo git stash pop that results in merge conflict

Undo git stash pop that results in merge conflict

Asked on January 8, 2019 in Git.
Add Comment


  • 3 Answer(s)

    Try this following solution:

    1. To unstage the merge conflicts: git reset HEAD .
    2. To save the conflicted merge (just in case): git stash
    3. To return to master: git checkout master
    4. To pull latest changes: git fetch upstream; git merge upstream/master
    5. To correct my new branch: git checkout new-branch; git rebase master
    6. To apply the correct stashed changes: git stash apply [email protected]{1}

     

    Answered on January 8, 2019.
    Add Comment

    Git stash pop does not change the stash

    Git checkout -f is personal belongings to forgot,  the . git merge missing-branch

    Just fire git stash pop again to get the same stash

    Concentration: Still, uncommitted changes in the working directory are not.

    Answered on January 8, 2019.
    Add Comment

    Luckily git stash pop does not change the stash in the case of a conflict!

    So nothing, to worry about, just clean up your code and try it again.

    Say your codebase was clean before, you could go back to that state with: git checkout -f
    Then do the stuff you forgot, e.g. git merge missing-branch
    After that just fire git stash pop again and you get the same stash, that conflicted before.

    Attention: The stash is safe, however, uncommittedchanges in the working directory are not. They can get messed up.

    Answered on February 20, 2019.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.