Ignoring Already Modified Files in Git

March 18, 2020

I've encountered a rare scenario where a file has been modified, but I don't want to commit this change to Git. There are various methods to achieve this, such as using a .gitignore file. However, this approach doesn't work if the file is already being tracked.

2020 03 18

The solution is to manually ignore the file by executing the following command:

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

To start tracking the file again, you can revert this action by using the following command:

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

Feel free to reach out if you have any questions.


Profile picture

Victor Leung, who blog about business, technology and personal development. Happy to connect on LinkedIn