Last active
March 10, 2019 01:42
-
-
Save secmohammed/d2aeeee9ba18b68b8ec56cfd02b2e9c4 to your computer and use it in GitHub Desktop.
How do I force “git pull” to overwrite local files?
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
First do a commit of your changes | |
git add * | |
git commit -a -m "local file server commit message" | |
Then fetch the changes and overwrite if there is a conflict | |
git fetch origin master | |
git merge -s recursive -X theirs origin/master | |
"-X" is an option name, and "theirs" is the value for that option. You're choosing to use "their" changes, instead of "your" changes if there is a conflict. | |
Or | |
git fetch --all | |
git reset --hard origin/master | |
git pull |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment