Skip to content

Instantly share code, notes, and snippets.

@mmeinhart
mmeinhart / git-reset-options
Created February 14, 2014 18:18
Git: Reset Options
# With git log check which commit is one prior the merge. Then you can reset it using:
git reset --hard commit_sha
# There's also another way
git reset --hard HEAD~5
# will get you back 5 commits.
# Assuming your local master was not ahead of origin/master, you should be able to do
git reset --hard origin/master
@mmeinhart
mmeinhart / git-discard-commits
Created February 11, 2014 21:55
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