Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How do I revert a pull request?

I've made a branch on one machine (call it the 1st machine) and then pushed my commits to the online server. Then I performed a `pull` request from a 2nd machine. On the 2nd machine I only had one master branch. I got that all the changes in my new branch are merged into my master branch. I did not expect this. I wanted to have the new branch on the 2nd machine as well.

I now see that I should have done "fetch" instead of "pull". The question is, how do I invert this pull request?

BTW, I saw the answer here, but I don't see a `Reset...` option when clicking on the last commit of master.

1 answer

1 accepted

1 vote
Answer accepted

You have to click on the commit you want to reset to, then you should see the option. You can also reset from the command line by using git reset --hard <commit to reset to>, or if you have not pushed your changes back to the remote master, you can use git reset --hard origin/master

In order to see new branches created on the remote you need to do a fetch in order to update your local repository. Doing a pull will not fetch any new branches, it will only fetch changes made on your current branch and then merge it.

@Mikael Sandberg Thanks. Do I need to choose the "hard" option when choosing to reset? It will not delete what I have on the server, right?

Mikael Sandberg Community Leader May 17, 2018

Hard will reset the index and working tree, meaning if you have made any local changes on master that has not been pushed to your remote, those will be deleted. 

@Mikael Sandberg I did this, and indeed it works. In the history view I still see the latest commit I did by mistake, but the files are reverted.

Now, I did fetch, but I don't see the new branch in my 2nd machine. Why is that?

Mikael Sandberg Community Leader May 17, 2018

Did you check under Remotes > Origin?


You can also run git branch -r to list all the remote branches that your local repository knows about.

@Mikael Sandberg I see it under Remotes > Origin.

How do I put it in my local stuff?

Mikael Sandberg Community Leader May 17, 2018

Right-click on it and select Checkout origin/..., that will bring up the checkout branch screen and from there you just select OK and it will create a local copy of the branch and setup the link to the remote branch.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

7,237 views 5 14
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you