cssdev
cssdev

Reputation: 79

git pull broke something - how to go back to previous working commit and merge the remote changes in again?

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.

Upvotes: 1

Views: 490

Answers (1)

VonC
VonC

Reputation: 1329692

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.

Upvotes: 1

Related Questions