Cancel git merge but keep local changes

后端 未结 4 986
灰色年华
灰色年华 2021-02-20 05:40

I started a git merge, but made local changes that I want to keep. I no longer want to merge, and instead continue to work on the local changes. How do I do this?

4条回答
  •  鱼传尺愫
    2021-02-20 05:58

    Found a tested solution for:

    1. keep all current changes in the working directory, whether you manually edited those files OR the merge that you are in the middle of brought them in
    rm .git/MERGE*
    rm .git/ORIG_HEAD
    

    Might be a bit dangerous as you're basically directly interfering with git's internal working, so maybe back up your folder first :)

提交回复
热议问题