Reputation: 926
In the following image you will see firstly the real situation and then the solution I would like to have
So I want to undo the merging done from B to A.
The problem is that everything was already pushed and the development went on with the branch C, and also I've done a new commit on A after merging it with B.
Is it possible to change this git situation to the second image or is a "reverse commit" the only way to go to correct the mistake?
But the resulting scheme I get doesn't look clear, that's why I'm seeking another answer
Upvotes: 2
Views: 6481
Reputation: 8838
Branch C looks like that:
...--a---------M--f--g--h--i--j
\ / ^ ^
b--c--d [A] [C]
^
[B]
First, you should rebase branch C
:
git rebase --onto <sha-of-commit-a> B C
After this operation branch C should look like that:
a--f'--g'--h'--i'--j'
^
[C]
Now is the time to update branch A
:
git checkout A
git reset --hard <sha-of-commit-g'>
That's all. Your repository should look like this merge never happened.
Upvotes: 2