Go Back

I messed up, git me back to what is on origin!

Posted: 

I can't tell you how much I used this command and yet every time I have to look it up. Maybe if I write a quick blog about it I'll remember. Or at least I can bookmark it for when I need it.

  • Checkout the local branch you want to replace (for instance mybranch)
  • git reset --hard origin/mybranch

This updates your local HEAD branch to be the same revision as origin/mybranch, and --hard will sync this change into the index and workspace as well.