Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a git revert similar to svn revert? I need a single command to erase *everything* in my local and set it to remote head

Tags:

In svn or subclipse, I can simply do a 'revert' on the root project and all my local changes are discarded and src is updated to the latest in HEAD. I don't seem to find an equivalent of this in git though several blogs claim the same.

This is what I did:

  • committed 10 files from my home mac. did not push.
  • committed the same 10 files and more from work computer and PUSHED.
  • came back home and I want to take the latest from remote origin/master.

tried git pull, it brought in changes but warned of conflict

tried git reset --hard HEAD, but nothing happened. I still see the committed conflicted changes

I must've tried few other commands I don't remember. I just need to get back to remote head and not worry about what state my local repo is.

Help?

like image 752
pri Avatar asked Sep 10 '11 00:09

pri


1 Answers

You need to reset to origin/master:

git reset --hard origin/master 
like image 62
holygeek Avatar answered Sep 20 '22 18:09

holygeek