Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

undoing a pull from the wrong github repository

Tags:

git

github

I just did a pull from github and pulled from the wrong github repository into my project. How do I undo this?

Thanks!

like image 237
Barka Avatar asked Mar 17 '12 23:03

Barka


1 Answers

git reset --hard HEAD^

This command resets your branch to the previous commit, that is the commit before the merge commit, which is the one you want to undo. Your work will be left untouched.

Remember that everything that has been commited is still there as loose objects and you can always use git reflog to revert to any version HEAD has pointed to before. This is why it's so important to commit often with git, you can undo all changes you have done with ease.

like image 58
ralphtheninja Avatar answered Sep 22 '22 05:09

ralphtheninja