Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Removing a merge on Sourcetree

I made quite few changes in my project (I was working on a remote branch and not the master), I committed them and created a pull request on BitBucket and merged the branch to master. I had forgotten to push my changes after the commit. Now, after trying switching the current branch to my remote branch and reverting to the commit before the merge, I managed to get all my changes back and back them up elsewhere in my system. What I want to do now is undo the bad merge that I did. Each time I click on the merge and select "Reverse commit", I get the following error message:

"error: Commit <commit_id> is a merge but no -m option was given.

fatal: revert failed"

I want to basically remove the merge and bring it to a state such that it doesn't say master(4 behind) anymore.

I am new to source control and I would appreciate it if anyone could help me out with this.

1 answer

1 accepted

10 votes
Answer accepted
Seth
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.
Mar 19, 2014

Instead of reversing the commit, you want to reset the target branch (master, it sounds like) to the commit before the merge. To do this in SourceTree, right click the commit before the merge, and choose "Reset to this commit". You probably want to do a hard reset, which will reset your working copy to that commit as well, but make sure you don't have any changes you want to keep, or you'll lose them.

Great! Thanks. That suggestion worked! :)

This is giving me pull when i try to reset commit any suggestions on this

"Reset to this commit" will work only for commits that are not pushed. 

Like # people like this

This is giving me pull when i try to reset commit any suggestions on this So how can we remove pull . 

To make it work for pushed commits; after "Reset current branch to this commit" you have to Push with "Force Push" checkbox enabled - but be careful as this can have destructive behavior.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events