How do I force “git pull” to overwrite local files?

If you have any files that are not tracked by Git (e.g. uploaded user content), these files will not be affected.


First, run a fetch to update all origin/<branch> refs to latest:

git fetch --all

Backup your current branch:

git checkout -b backup-master

Then, you have two options:

git reset --hard origin/master

OR If you are on some other branch:

git reset --hard origin/<branch_name>

Leave a Comment