Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to revert a very old git merge commit?

Ajay_Pratap March 9, 2018

Suppose I have a feature branch and a master branch, I commit few changes in my feature branch and merged it with master branch and few other branches get merged to master after that. Now I want to revert my changes and remove my code from the master branch. How can I do so?

Case 2: my feature branch is merged to master more than once and few other branches are also merged in between. and I want to remove all my commits from master branch.

I am using Bitbucket server as my Git repository. Any plugin to do the job would be perfect. Thanks in advance.

1 answer

0 votes
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 9, 2018
Ajay_Pratap March 9, 2018

I have tried git revert, the main problem is the number of commits on the master branch. The number is so high that git revert could be error-prone( because of manually resolving conflicts, if any).

I am looking for an alternate solution, perhaps some tool or plugin.

If you could help for the same, I'm all ears.

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 9, 2018

When you do a merge, you can just revert the merge commit. You do not need to revert the individual commits in the merge. If you are already doing that, and you have lot of merge commits to be reverted, then you are out of luck I am afraid.

In reality, this shouldn't be an ongoing issue because that would mean that your branching workflow needs to be adjusted.

Sorry, I know I am not giving you a solution to revert multiple commits in one go :)

Ajay_Pratap March 11, 2018

Thanks for your reply. :)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events