I have finished a lengthy merge of a devel branch onto master, then I realised it should have been a devel update instead, meaning the direction should be master -> devel. Is it possible to change the destination
of the commit, so that the arrow is pointing from master to devel?
note: The resulting changes in files would be exactly same for both
- I resolved all conflicts in a devel->master merge.
- I haven't
commited or pushed the changes.
- Changes are made on top of master.
need to apply the resolved conflicts in a master->devel direction.
Reverting a merge on the branch is as simple as determining which commit was the previous one.
First, checkout on the branch you want to modify. It's a git-golden-rule: you can only modify the branch you're on.
git checkout master
Then, figure out the previous-master commit it, and force master back into its previous state
git reset --hard <previous-commit-id>
Finally, do your merge right
git checkout devel git merge master
What you could also do, if you want to be lazy, is invert branch states.
You still need to find master's previous commit it.
git checkout devel git reset --hard master git checkout master git reset --hard <previous-commit-id>
That should do the trick.