Git merge left HEAD marks in my files

前端 未结 5 817
旧时难觅i
旧时难觅i 2020-11-22 15:26

I tried to merge a file in the command line using Git, when an error message appeared telling me the merge was aborted.

I thought that was the end of it, but then I

5条回答
  •  鱼传尺愫
    2020-11-22 15:50

    I'm coming from this question. And I wanted some automated method of merging the half merged files, instead of manually editing the files (as suggested in other answers, which I am not really comfortable doing). So here's what I ended up doing via netbeans, but can be done via command line too.

    Now, bear in mind, this only works if immediately after the merge->add->commit, you realised that you messed up, and want to re-go through the process.

    STEP 1: Reset to a previous commit.

    git reset --hard a992a93f9312c6fa07c3a1b471c85e9fbf767d0e
    

    STEP 2: Re-Try Merging the branch

    git merge --ff origin/feature/YOUR-Branch_here
    

    At this point you shall be prompted with the merging window if you are using a GUI. and you can then proceed as normal.

提交回复
热议问题