The following untracked working tree files would be overwritten by merge
- 1 Min. Read.
When you git pull
from your origin you might be greeted by the following error:
What triggers this error?
Say you have the following folder structure:
1 2 |
├── file.txt └── newFile.txt |
You initialize a repository, add a remote and pull from master, and coincidentally, there’s a file in the repository called file.txt
.
Git is warning you here, that pulling will overwrite your local file.txt
(and protecting you from yourself!).
Force overwrite the local file
If you’re certain that you want to overwrite your local files, you can use the following command:
1 |
git fetch --all && git reset --hard origin/master |
Use with caution!