Skip to content

Instantly share code, notes, and snippets.

@secmohammed
Last active March 10, 2019 01:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save secmohammed/d2aeeee9ba18b68b8ec56cfd02b2e9c4 to your computer and use it in GitHub Desktop.
Save secmohammed/d2aeeee9ba18b68b8ec56cfd02b2e9c4 to your computer and use it in GitHub Desktop.
How do I force “git pull” to overwrite local files?
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