version-control - git is a centralized version control system - How do I force “git pull” to overwrite local files?

git overwrite local file / git / overwrite / git-pull / git-fetch

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


Answer #1

First of all, try the standard way:

git reset HEAD --hard # To remove all not committed changes!
git clean -fd         # To remove all untracked (non-git) files and folders!

If above won't help and you don't care about your untracked files/directories (make the backup first just in case), try the following simple steps:

cd your_git_repo  # where 'your_git_repo' is your git repository folder
rm -rfv *         # WARNING: only run inside your git repository!
git pull          # pull the sources again