Temporarily ignore changes
During development it’s convenient to stop tracking file changes to a file committed into your git repo. This is very convenient when customizing settings or configuration files that are part of your project source for your own work environment.
git update-index --assume-unchanged <file>
Resume tracking files with:
git update-index --no-assume-unchanged <file>
Permanently ignore changes to a file
If a file is already tracked by Git, adding that file to your .gitignore is not enough to ignore changes to the file. You also need to remove the information about the file from Git’s index:
These steps will not delete the file from your system. They just tell Git to ignore future updates to the file.
- Add the file in your .gitignore.
- Run the following:
git rm --cached <file>
-
Commit the removal of the file and the updated .gitignore to your repo.
(Source docs.microsoft.com/en-us/vsts/repos/git/ignore-files)