Git ignore already modified files

March 18, 2020

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.


Profile picture

Experience in software development, application architecture, and deploying cloud solutions for enterprise customers. Strong hands-on skills with a Master's degree in Computer Science and business acumen with a master of business administration (MBA) in Finance. Certified in Amazon Web Services (AWS), Google Cloud Platform (GCP), Microsoft Azure, Kubernetes (CKA, CKAD, CKS, KCNA) and Scrum (PSM, PSPO) with experience in building banking products from scratch. Connect on Linkedin

© 2022, @victorleungtw