Reputation: 545
Here is the situation: I have an old branch branch1
from master
and I wanted to update it so I rebased branch1
on master
and that took me an hour of fixing conflict.
I still didn't force push the branch after rebasing but now I need to go bach to the branch1
before rebasing without losing the rebasing effort that i did ( like doing reset --hard origin/branch1
).
Any suggestions?
Upvotes: 0
Views: 215
Reputation: 7632
The theoretical answer is git rerere
should deal with it.
In a workflow employing relatively long lived topic branches, the developer sometimes needs to resolve the same conflicts over and over again until the topic branches are done (either merged to the "release" branch, or sent out and accepted upstream).
This command assists the developer in this process by recording conflicted automerge results and corresponding hand resolve results on the initial manual merge, and applying previously recorded hand resolutions to their corresponding automerge results.
To avoid bad surprise, I recommend create a new branch.
git checkout -b branch1rebased
Go back to branch1
git checkout branch1
git reset --hard origin/branch1
fix and try the rebase.
Everything go well not need to do something else. Nightmare of conflict abort rebase and go back to the previous branch
git rebase --abort
git checkout branch1rebased
Cherry pick your fix
git cherry-pick branch1
Fix if need the conflict
Upvotes: 1