Keep file local and do not change with pull

I have a shared repo containing a file which is used for keeping constants and local path, which I have modified for my local needs.
Now, when I try to pull the repo, git finds a conflict for that particular file and asks me to commit or stash it.
What I would like to do now is:
a) pull the repo without changing that specific file and
b) ignore that file for the future
What is the standard way to do that?

As a short term workaround, you can stash the file, pull, unstash, and continue working. See: Git - Stashing and Cleaning

There is no way to ignore changes to a file that has been committed to the repository. Local configuration should go to a file that isn’t part of the repository (as in not committed, it can be in the directory). You can then add that file to .gitignore and won’t have any trouble.

1 Like