Git – Force Overwrite of Untracked Working Tree Files

GitWhen it comes to version control, I prefer Subversion over Git.

This is for several reasons:
1) Subversion is easier to use
2) The software that interfaces with SVN is generally simple and well-polished
3) It’s what I know the most

With that said, I do believe that Git has the most capabilities.

Why am I saying all of this? Well, just like my other posts, it’s related to what I’ve been working on. We’re using Git for version control and because the repo is directly modified sometimes (never recommended), we’ll occasionally get an error similar to the below one when doing a git pull:
Error: Untracked working tree file ‘xxxxx’ would be overwritten by merge.

In our particular case, we want to overwrite these files. So what do we do? We use the following:

git fetch --all
git reset --hard origin/master

This grabs the latest repository files without merging and resets the master branch and overwrites the modified ones.

Incoming search terms:

  • the following untracked working tree files would be overwritten by merge
  • The following untracked working tree files would be overwritten by checkout
  • error: The following untracked working tree files would be overwritten by merge:
  • The following untracked working tree files would be overwritten by checkout:
  • following untracked working tree files would be overwritten by checkout
  • !g cannot checkout due to The following untracked working tree files would be written by checkout:
  • git pull overwrite
  • git merge overwrite file
  • git merge force overwrite untracked files
  • git merge force overwrite a file

Comments

  1. By oci

    Reply

  2. By sona

    Reply

Leave a Reply

Your email address will not be published.