I encounter a rare scenario that there is a file modified, but I don’t want to commit this change on git. There are many ways to do such as .gitignore file, but it doesn’t work when the file already tracks.

The solution here is to manually ignore the file by entering this command:

git update-index --assume-unchanged <file path>

To start tracking again, revert by using this command:

git update-index --no-assume-unchanged <file path>

Feel free to reach out if you have any questions.