temporarily-ignore-local-changes-to-a-tracked-file-in-git

Today I learned that you can tell Git to temporarily ignore changes to a tracked file using:

Terminal window
git update-index --assume-unchanged <file>

After this, Git won’t show changes to the file in git status, git add, or git commit.

To start tracking changes again:

Terminal window
git update-index --no-assume-unchanged <file>

Caution

  • ❗️ If the file is modified in the remote branch and you pull, Git may overwrite your local changes.
  • ❗️ This is only for temporary local changes; the file remains tracked in the repository. This is mainly an optimization for large repositories, as Git will skip checking the file for changes, speeding up status and diff.

Side Notes

  • This is mainly an optimization for large repositories, as Git will skip checking the file for changes, speeding up status and diff.
Thanks for reading! If you found this page useful, consider buying me a coffee.
© 2025 Hua-Ming Huang · licensed under CC BY 4.0