How to Make Git Assume Files Are Unchanged

You can set Git to assume certain files haven't changed even when they have (without adding them to your .gitignore file). This way, it won't track changes to make to one (or multiple) files.

Tell Git to assume a file is unchanged

git update-index --assume-unchanged file

Tell Git not to assume a file is unchanged anymore

After this command is run, the repository continues tracking the file. It might have changes that git will want to commit.

git update-index --no-assume-unchanged file

Roll back the changes you made while the file was --assume-unchanged

In case you made changes while --assume-unchanged was on and don't want to keep the changes on the file: Roll-back to where the repository is when you want to pull or push changes.

git checkout -- file