Skip to content

Instantly share code, notes, and snippets.

@mmeinhart
Created February 11, 2014 21:55
Show Gist options
  • Save mmeinhart/8944982 to your computer and use it in GitHub Desktop.
Save mmeinhart/8944982 to your computer and use it in GitHub Desktop.
Git: Discard Local Commits
# fetch from the default remote, origin
git fetch
# reset your current branch (master) to origin's master
git reset --hard origin/master
### Ours Merging Method
# fetch from the default remote, origin
git fetch
# create a branch at your current master
git branch old-master
# reset to origin's master
git reset --hard origin/master
# merge your old master, keeping "our" (origin/master's) content
git merge -s ours old-master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment