Have you ever been working on a project in and ran into an error telling you that you can't use because you have local changes? git git pull error: Untracked working tree file 'App.vue' would be overwritten by merge This is usually because some changes have been committed to the repo you are pulling from - but you have a similar file locally. For example, if a file gets accidentally added to a repo called , and you already have on your local version. README.md README.md Sometimes though, you want to force overwrite your files with the ones found in the repo. In this scenario, your local changes will be replaced by the ones found on the remote repository. Forcing git pull To force a , you want to do three things: git pull first sync up and fetch all remote repository changes. backup your current branch - since when we force the pull, all changes will be overwritten. force the . git pull The important thing to do here is a backup, where you commit all your local changes to a backup branch. You can also copy your files somewhere else if you're worried about overwriting them. If you do not commit/backup your local changes to another branch, they will be overwritten so be careful. :) please To force a , we run the following commands to create a backup branch, and then force the on the master branch: git pull git pull git fetch --all # Creates a new branch git branch my-backup-branch # Switch to the new branch.. we'll use it to backup our local changes git switch my-backup-branch # Add all files to a commit git add . # Commit the new branch, so that it is saved git commit -m "Backup of branch" # Switch back to our main branch, `master` git switch master # Force git pull using `git reset --hard` git reset --hard origin/master First, syncs up our remote to our local. Then, creates a new branch, which we switch to for the backup. After that, I've added in a , so that we commit any changes on that backup branch, , so the contents remain saved. . git fetch --all git branch my-backup-branch commit my-backup-branch If you don't commit your changes to the backup branch, you will lose them Then we switch back to our main, branch, assuming your main branch is called . If it's called something else, you will have to use that command. You can see all other branches available to switch to by running . master master git branch --list Finally, we use to force git pull. This will force overwrite any local changes you made. git reset --hard origin/master And you're done. Now your local changes will be backed up on the branch , and all remote changes will be forced into your branch. my-backup-branch master Forcing Git Pull - the key command The key command to force a git pull from a remote repository is . The other commands are to ensure you don't lose any data, by making a backup! git reset --hard origin/master Can't find origin/master If you can't find , you may now have that branch on your origin. Instead, try running to see any remote branches, so you can pick the one you want to from. origin/master git branch -r git reset Also Published Here