Git Local Overwrite

If your local repository is behind that of the remote repository and your locally tracked files differ from those of the remote repository, you will encounter an error. Performing the steps will result in the following:

  • If the locally tracked files exist on the remote repository, the remote files will overwrite the local files.
  • If the locally tracked files do not exist on the remote repository, they will be removed from your local repository.
  • If the local files are not being tracked, they will be left intact.


Here is an example of the error you will see:

If you then try to do a pull , you’ll end up with this error:

If you’re happy to lose your locally tracked files, you can re-sync with the remote repository by issuing the following commands:

Knowledge Base

See the Git section of my Knowledge Base for more information.

As always, if you have any questions or have a topic that you would like me to discuss, please feel free to post a comment at the bottom of this blog entry, e-mail at, or drop me a message on Twitter (@OzNetNerd).

Note: This website is my personal blog. The opinions expressed in this blog are my own and not those of my employer.