⚠ Warning:

Any uncommitted local change to tracked files will be lost, even if staged.

But any local file that's not tracked by Git will not be affected.


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

git fetch --all

Backup your current branch (e.g. main):

git branch backup-main

Jump to the latest commit on origin/main and checkout those files:

git reset --hard origin/main

Explanation:

git fetch downloads the latest from remote without trying to merge or rebase anything.

git reset resets the master branch to what you just fetched. The --hard option changes all the files in your working tree to match the files in origin/main.


Maintain current local commits

[*]: It's worth noting that it is possible to maintain current local commits by creating a branch from main before resetting:

git checkout main
git branch new-branch-to-save-current-commits
git fetch --all
git reset --hard origin/main

After this, all of the old commits will be kept in new-branch-to-save-current-commits.

Uncommitted changes

Uncommitted changes, even if staged (with git add), will be lost. Make sure to stash or commit anything you need. For example, run the following:

git stash

And later (after git reset), reapply these uncommitted changes:

git stash pop

Which may create merge conflicts.

Answer from RNA on Stack Overflow
🌐
Git Tower
git-tower.com › learn › git faq › how do i force git pull to overwrite local files?
How do I force git pull to overwrite local files? | Learn Version Control with Git
5 days ago - Force a git pull to overwrite local files: Stash or discard changes & untracked files, then pull. Avoid conflicts with Tower's auto-stashing!
Discussions

git - Resolve merge conflicts: Force overwrite all files - Stack Overflow
Now I'm trying to pull back and it's complaining about hundreds of merge conflicts. Is there a way to tell git to forcefully overwrite any and all files locally that are coming from the remote server? More on stackoverflow.com
🌐 stackoverflow.com
git - How to pull files and only override conflicts - Stack Overflow
How can I pull down a git and have it overwrite my local project ONLY where conflicts are found? E.g. I have many folders / files in my local project that are not on the git project and never will... More on stackoverflow.com
🌐 stackoverflow.com
How to force pull to overwrite merge conflicts?
The recommended approach to this on stackoverflow is git fetch --all Then, you have two options: git reset --hard origin/master OR If you are on some other branch: git reset --hard origin/ I can git subrepo fetch --all but I... More on github.com
🌐 github.com
6
June 22, 2017
github - Git pull to overwrite conflict files only - Stack Overflow
I am trying to set up a process that will automatically pull from the repo every a few minutes and set up some script to run and make local changes. For example, I have two changed files in the l... More on stackoverflow.com
🌐 stackoverflow.com
🌐
ITsyndicate
itsyndicate.org › blog › how-to-use-git-force-pull-properly
Git Pull Force to Overwrite Local Changes - Right Way
So user2 pulls changes and runs into a problem: ... At this stage, if you check the history of user2's workspace, you see that user2 has the following log: ... The conflict can be manually resolved. But user2 decides to get rid of the local changes and start from where user1 left off. The following method is the most effective way to force git pull:
🌐
GitProtect.io
gitprotect.io › strona główna › how to use git pull force to overwrite local files
How to Use Git Pull Force to Overwrite Local Files - Blog | GitProtect.io
September 17, 2024 - The git merge command integrates changes from one branch into another, resolving any conflicts that may arise. I mentioned downloading the latest version of the code. This is what the “pull” operation is for.
🌐
Software House
softwarehouse.au › home › blog › how do i force git pull to overwrite local files
How Do I Force Git Pull to Overwrite Local Files?
March 2, 2026 - Forcing a git pull to overwrite local files can be done safely using git fetch and git reset. This method ensures you sync with the remote repository while discarding local changes.
🌐
CodeLucky
codelucky.com › home › how do i force git pull to overwrite local files? – version control insights
How do I force git pull to overwrite local files? - Version Control Insights - CodeLucky
August 30, 2025 - If you have local uncommitted changes ... safely force a pull and overwrite local files, you need to reset your local changes first or fetch and reset to remote explicitly....
Find elsewhere
🌐
Saturn Cloud
saturncloud.io › blog › how-to-force-git-pull-to-overwrite-local-files
How to Force git pull to Overwrite Local Files | Saturn Cloud Blog
May 1, 2026 - When you run “git pull”, git ... local changes and the changes from the remote repository, git will typically prompt you to resolve those conflicts manually....
🌐
Codecademy
codecademy.com › article › force-git-pull
How to Force Git Pull to Overwrite Local Changes in Git | Codecademy
Learn how to force `git pull` in Git to overwrite local changes safely using `git reset --hard` and `git stash`. Understand use cases, risks, and best practices.
🌐
Squash
squash.io › how-to-force-git-pull-to-overwrite-local-files
How to Force Git Pull to Overwrite Local Files - Squash Labs
August 20, 2023 - One way to force a Git pull to overwrite local files is by using the "--force" option with the "git pull" command. This option tells Git to overwrite local changes and update your local copy with the latest changes from the remote repository.
🌐
Lineserve
lineserve.net › home › blog › how to force git pull to overwrite local files: complete step-by-step guide
How to Force Git Pull to Overwrite Local Files: Complete Step-by-Step Guide — Lineserve Blog
December 11, 2025 - Best practice: Name your stashes for clarity if you have multiple: git stash save "work on feature X". Technically, there’s no direct git pull --force command, but you can force a pull by combining fetch and reset (as in Method 1) or use git pull --force-with-lease in some cases.
🌐
SourceBae
sourcebae.com › home › how to force git pull to overwrite local files [2026 guide]
How to Force Git Pull to Overwrite Local Files [2026 Guide] - SourceBae
February 11, 2026 - People usually mean git pull --force or git reset --hard origin/main – both force overwrite local changes with remote versions. ... This is the safest and most reliable method across all Git versions.
🌐
GitHub
github.com › ingydotnet › git-subrepo › issues › 276
How to force pull to overwrite merge conflicts? · Issue #276 · ingydotnet/git-subrepo
June 22, 2017 - The recommended approach to this on stackoverflow is git fetch --all Then, you have two options: git reset --hard origin/master OR If you are on some other branch: git reset --hard origin/ I can git subrepo fetch --all but I...
Author   ingydotnet
🌐
OpenReplay
blog.openreplay.com › openreplay blog › git force pull: how to safely overwrite local changes and sync with remote
Git Force Pull: How to Safely Overwrite Local Changes and Sync with Remote
February 10, 2025 - To wipe those files too, use git ... While git pull --force may sound like the right command, it’s better to use git fetch and git reset --hard to overwrite local changes and sync with the remote repo....
🌐
Flexiple
flexiple.com › git › git-pull-force
Git Pull Force – How to Overwrite Local Changes With Git - Flexiple
To force a pull, execute git fetch followed by git reset --hard origin/<branch_name>. This fetches the latest history from the remote and forcefully aligns your local branch to it.
🌐
DataCamp
datacamp.com › tutorial › git-pull-force
Git Pull Force: How to Overwrite a Local Branch With Remote | DataCamp
August 6, 2024 - To resolve a conflict, we edit the file by deleting these lines except the ones we want to keep. After handling all of the conflicts, we can commit the changes. For an in-depth guide, check out this tutorial on how to resolve merge conflicts in Git. If we really want to first make our local ...
🌐
Stack Overflow
stackoverflow.com › questions › 43264737 › git-pull-to-overwrite-conflict-files-only
github - Git pull to overwrite conflict files only - Stack Overflow
@CodeWizard, Hi, I would like to pull the files that have conflicts from the server and local files, but only these files, not the ones that have local change but no conflict to pull. Thx ... git cannot checkout different versions of files into same working copy.
🌐
freeCodeCamp
freecodecamp.org › news › git-pull-force-how-to-overwrite-local-changes-with-git
Git Pull Force – How to Overwrite Local Changes With Git
July 20, 2020 - Just like git push --force allows overwriting remote branches, git fetch --force (or git pull --force) allows overwriting local branches. It is always used with source and destination branches mentioned as parameters.