1

Me and my co-worker usually merge each other branchs before we create merge request .But lastime when he merge my branch i found out there some errors so he do revert his code.

The problem right now is that when i merge his branch, all my changes file are being deleted and even when he merge my branch, my code still get delete. I really need some help in here

Lê VỸ
  • 11
  • 1
  • Please show the commands you used. It sounds like his revert commit deleted files and since it is after your commit it removes yours. The easy solution, if you can remove all of his commits, would be to find the last commit you made that was correct by the commitID/hash and do a checkout of the code at that point and then override the branches. – ViaTech Feb 13 '22 at 13:01
  • So I just asking him how he revert code and he said that he just undo all the change from merge and then commit. – Lê VỸ Feb 13 '22 at 13:22

1 Answers1

0

If your coworker has merged your branch first, and then removed your changes (during the "undo all the change from merge and then commit" step), then it is expected that merging his branch result in your work being removed.

I would prefer for the coworker to reset his branch to before the first merge, re-do the merge properly, force push (git push --force)

Same for you: reset before the last merge (the one which removed your work), fetch, and then merge the branch.

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