Steps i performed:
I have two branches branch1 and branch2,
$git branch --Initial state
$branch1
$git checkout branch2
$git pull origin branch1 --Step1
The first option is the use of git revert
.
git revert -m 1 [sha-commit-before-merge]
The git revert
will revert the changes but will keep the history. Therefore you will not be able to continue working in the same branch since you cannot see the actual difference between the merged branch and your feature branch anymore.
Use the following way to remove history as well. Do this very carefully if and only if you are the only one pushing changes to the branch at the moment.
git reset --hard [sha-commit-before-merge]
git push [origin] [branch] --force