← Back

Snippet to unset assume unchanged on git

For some strange reason I needed to unset the assume-unchanged bit on a but of files that were in a git repo.

This snippet should help you achieve this:

git ls-files -v | grep 'something or other' | grep '^h' | awk '{ print $2 }' | xargs git update-index --no-assume-unchanged

NOTE: Does not use -z on ls-files with related -0 on xargs which would make filenames in spaces work. I don't think you get the 'h' marker when you use ls-files -z

If you just want to unset all of them, something like this would perhaps suit.

git ls-files -z | xargs -0 git update-index --no-assume-unchanged