How can I get the awful old branch up to speed with the main one?

One of our branches hasn't worked for 10 months, we want to bring it up to speed with the main one, but there are a lot of merge conflicts. How can I just make it fork with current and discard all conflicts?


source to share

3 answers

If you're fine with discarding any changes on branch foo, just do:

git fetch origin
git checkout foo
git reset --hard origin/foo




I'm guessing that a reboot won't be possible if it's 10 months old because you've probably gone through a lot of push and pull between different developer repos now?

It looks like if you have too many fundamental differences in your code, someone will just have to suck it up and manually do the merge work, at least GIT should indicate all the work to be done here.

Otherwise, you can always just rewrite the functions you want from the old branch to the latest codebase, I suppose? How annoying it is, it's usually pretty quick to recreate what you've already done.



It sounds like you are saying that you just want all merge conflicts to go away so you can commit the merge results. If so, just do "git rm" all files that show up as "need to merge / conflict". After that, you can transfer the "old branch". Then, from the new codebase, copy over all the files you removed with "git rm", add them and copy over again. Now you have 1) all the new code, 2) most of the old code, and 3) work forward to get it working.



All Articles