0

Before committing my local change I have accidentally took a pull from master on to my release feature branch. The pull have made many conflicts within my local workspace.

Is there any way to revert the accidental master pull

When I triggered

git reflog --date=iso

c0ec509 HEAD@{2018-12-24 15:55:10 +0530}: clone: from https://bitbucket.com/scm/myproject.git

but the pull which I have done is at 2018-12-28 01:29

Can anyone please tell me how to resolve this.

A.H.
  • 63,967
  • 15
  • 92
  • 126
Alex Man
  • 4,746
  • 17
  • 93
  • 178
  • Possible duplicate of [Undo git pull, how to bring repos to old state](https://stackoverflow.com/questions/1223354/undo-git-pull-how-to-bring-repos-to-old-state) – phd Dec 31 '18 at 13:19
  • https://stackoverflow.com/search?q=%5Bgit%5D+undo+pull – phd Dec 31 '18 at 13:20

3 Answers3

3

Try git reset --merge. This will abort the merge you have started.

Konstantin Labun
  • 3,688
  • 24
  • 24
2

git merge --abort to abort the merge.

git reset --hard <commitId> to reset to a specific commit, you will lose anything.

git reset --soft <commitId> to reset to a specific commit, keeps uncommitted changes.

To make sure you do not lose your local commit you can use git stash before doing anything and git stash pop when everything is fine.

elp
  • 840
  • 3
  • 12
  • 36
1

In order to keep your uncommited changes try:

git reset --soft

Muhammad Bilal
  • 2,106
  • 1
  • 15
  • 24