error: Your local changes to the following files would be overwritten by merge

Whilst doing a git pull command that always worked, you see a new error:

username@host application]$ git pull

Updating 4a81dc8..fe35c1a
error: Your local changes to the following files would be overwritten by merge:
public/token.json
Please, commit your changes or stash them before you can merge.
Aborting

In this particular case a file called ‘public/token.json’ was generated by a Google API server, so it appeared out of the blue. A quick way to get rid of the issue is:

git checkout public/token.json

That command will discard the changes for the file

Reference:
https://stackoverflow.com/questions/15745045/how-do-i-resolve-git-saying-commit-your-changes-or-stash-them-before-you-can-me

Tags

Share this article

2 thoughts on “error: Your local changes to the following files would be overwritten by merge”

  1. Eugène van der Merwe

    Hi @Diego,

    Thank you so much for your reply. Indeed Git Stash could also work. Would you say this is the preferred method?

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top