Created
February 11, 2014 21:55
-
-
Save mmeinhart/8944982 to your computer and use it in GitHub Desktop.
Git: Discard Local Commits
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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