Chad Stewart Chad Stewart - 1 year ago 70
Git Question

What to do when new commits happen after a git rebase?

I just got done with a particularly hairy rebase (someone worked for weeks on a branch without ever rebasing.) It took me about two or three hours because the "human readable" format that I was using is just a bunch of IDs and references.

While I was doing this rebase, two more commits showed up on the branch before I had the chance to git push the result of the rebase.

Is there a best practice for getting those new commits without re-doing the rebase or resorting to a merge? My initial thought was that I could git cherry-pick those new commits and git push -f, but would that be unsavory?

Answer Source

You should be able to rebase your commits again.

The only issue is that you will have to remake your conflict resolutions, because you did not activate git rerere.

Well,... you don't have to, with the script.
See "Do you even rerere?" by Tristan Roussel:

In this simplest form, the script starts from the commit you specified and go through every parent commit to look for conflicts.

That will allow you to record those past conflict resolutions, and rebase again without having to do them again.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download