0

My code has some bugs on the main branch, but I have the corrected code on some other branch. I don't know how to replace the code on the main branch with that one.

zzCoder
  • 19
  • 1
  • 1
    Do you want to rewrite the history so that the main branch does not have the bug anymore or do you want to create a new commit in the main branch that fixes the bug? – Thibault BREZILLON Aug 04 '22 at 16:33
  • 2
    A question _just like this one_ was asked a couple of hours ago. I wonder how many variations of the same question have been around here since it started. Try: `git checkout the-other-branch -- .` or `git restore --worktree --staged --source=the-other-branch -- .`. This does _not_ mess up with history... only bringing over _contents_ of what's in the other branch. – eftshift0 Aug 04 '22 at 16:33

0 Answers0