1

I commited a new feature locally, pulled from remote and got merge conflicts. After resolving them, my feature stopped working (seems like I made an error).

My idea was to go back to my commit and somehow repeat the merge. I checked out my commit, made a new branch, checked out master and tried to merge the new branch into master. This didn't work because "Everything is up to date".

How do I best handle this if I don't want to fix the error by looking through the code by hand?

/edit: I accepted the correct answer to the question but it turns out that my problem has a different origin than assumed above. I asked a follow-up question here.

cssdev
  • 59
  • 7
  • The fact that you got the message "Everything is up to date" is that you failed to go back to the original commit before the pull to create your branch. You need to do that. – Chris Dodd Dec 20 '20 at 20:53
  • 1
    "My idea was to go back to my commit and somehow repeat the merge" So just reset hard to the commit before the merge commit. Now the merge commit is gone and you are ready to merge from the remote tracking branch again. – matt Dec 21 '20 at 00:23

1 Answers1

1

If you do the checkout of your commit after the first merge to master, you will get an "Everything is up to date" when merging from master.

m--m--m
       \
 f--f1--F
      \
       newBranch: master is already merged

You need, as commented, to reset --hard to f1, and retry the merge.
As long as you don't push, you can reset/retry as many times as you need.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250