Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bitbucket, accidentally pulled wrong branch [duplicate]

Tags:

git

bitbucket

I happened to pull the wrong branch as I was supposed to pull the master branch but ended up pulling the development branch. This did merge my local repo. However, I would not like to merge the Bitbucket repo. Is there any way to reverse the pull or delete the merge request (see image)?

enter image description here

EDIT:

I haven't pushed any changes to my Bitbucket yes (as stated in the image).

like image 944
artobii Avatar asked Apr 02 '18 09:04

artobii


1 Answers

git reset will help you achieve this. More info at man git-reset.

In this specific case you are looking to reset your branch so that it points to the first parent of the merge commit, which is the commit on master right before the merge.

First, run git status to make sure you have no uncommitted changes, as the next command will delete them.

Then proceed to reset to the first parent:

git reset --hard HEAD^

like image 196
jsageryd Avatar answered Nov 20 '22 03:11

jsageryd