git update-index –assume-unchanged on directory

git update-index wants the file names on its command line, not on its standard input.

Step 1:

cd into the folder you want to assume is unchanged

Step 2:

You can do either this:

git update-index --assume-unchanged $(git ls-files | tr '\n' ' ')

or

git ls-files | tr '\n' ' ' | xargs git update-index --assume-unchanged

Although, with either case, file names with spaces will be problematic. If you have those, you can use this:

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

Edit: incorporated input from @MatthewScharley regarding git ls-files -z.

Windows Commands

Note: If you’re on windows, use Git Bash to run these commands

Leave a Comment