I was asked by my colleague to assist with following issue:
- He was working in a branch
feature
- He merged
master
intofeature
, which resulted in a huge swath of conflicts - He resolved many of the conflicts by "take theirs" or "take mine", often incorrectly.
- He commited and pushed the merge.
- He realized what he has done and called for help.
My first instinct was to move the pointer back using branch -f
, but that requires push --force
, which is disabled on the repo.
Second attempt was git revert -m
, which however reverted the merge completely and blocked me from doing again, saying "Already up-to date" (since technically all those commits from master
were aready merged in feature
).
As an immediate solution, I ended up discarding the branch and making a new, fixed one.
Is there a better way to fix this situation that doesn't require push --force
?