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.
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.