Steve Gricci
Geek. Coder. Father.

October 4th, 2011

How To: Revert a merge (by resetting to what is on a remote repo)

I generally do (as a force of habit) my integration testing on my master branch. I'll typically look at the change on GitHub and if I see something amiss, I'll denote it and move on. Every once in a while, I can't tell just by looking at the code, or have a suspicion that something will break but want to make sure.

In these cases, I generally am at a stopping point. (E.g. I have all my code checked in and pushed). In order to reset my local copy back to what's on the origin server, I do the follwing:

git reset --hard origin/master

Origin being the remote that I want to pull from and master being the branch.

 

I like to create stuff here.

You can find me at these places:

GitHub
Twitter
Flickr
Gimme Bar
Last.fm

Subscribe