I'm trying to ignore all changes to a very small file in my repo (Github). It is a hidden file (.first_run
), which contains a single character (0
). I use it (obviously) to detect a first run of my package.
I'm encountering these issues:
- The file is already tracked, so adding it to my
.gitignore
won't work. - I can't use
git rm --cached <file>
because it will remove that file from the repo, which is not what I want. - Using
git update-index --assume-unchanged <file>
also does not work. If, after applyingassume-unchanged
to the file, I change the0
for a longer string (e.g.:sdfgdgd
), it does not show as changed (correct behaviour) But if I change the0
for say a4
, it will show up as modified.
I assume the issue described in point 3. is due to what is explained in this answer:
Assume-unchanged (..) is not a promise by Git that Git will always consider these paths are unmodified---if Git can determine a path that is marked as assume-unchanged has changed without incurring extra lstat(2) cost, it reserves the right to report that the path has been modified (as a result, "git commit -a" is free to commit that change).
Is there anything I can do to make git
ignore future changes to this file?