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

View 3+ more / git / version-control / overwrite / git-pull / git-fetch

How do I force an overwrite of local files on a git pull?

Neo



Answer #1

You might find this command helpful to throw away local changes:

git checkout <your-branch> -f

And then do a cleanup (removes untracked files from the working tree):

git clean -f

If you want to remove untracked directories in addition to untracked files:

git clean -fd