Home > database >  How to undo git pull from master branch
How to undo git pull from master branch

Time:07-20

I wanted to make my branch up to date and mistakenly pulled from master branch using " git pull origin master " and now i have some 700 pending changes to commit. How do i undo this and not mess up anything in here?

Thanks!

CodePudding user response:

To undo the merge, you could use git reset --hard. This will reset the local repository to a previous state.

Be aware though that this will remove all uncommitted changes, potentially leading to a loss of work:

Alternatively, you can reset to a particular point in time, such as:

git reset --hard master@{"10 minutes ago"}

CodePudding user response:

I used git stash and that took me back to the clean working directory. Thank you for all your responses!

CodePudding user response:

git reset --hard master@{"[time]"}

and be sure to replace time since the last pull for detailed answer check this

Undo git pull, how to bring repos to old state

  • Related