git 1.7.12
I want to mark all files below a given directory as assume-unchanged.
-
git update-index --assume-unchanged dir/gives "Ignoring path." -
git update-index --assume-unchanged dir/*quickly fails because it will encounter files which are not being tracked, hence it gives "fatal: Unable to mark file" and quits. -
Try generating a list of files to mark.
cdinto the desired directory and then rungit ls-files | tr '\n' ' ' | git update-index --assume-unchanged. This produces no error message, but it does not successfully mark the files. The first portion of the command,git ls-files | tr '\n' ' ', correctly produces a space delimited list of all the files I want to mark. If I copy and paste the output of that command onto the command-line, then thegit update-indexcommand works. What is not working with the pipes?
No, it is not sufficient for me to add dir to .gitignore. I need these files to be in the repository, but undesired changes will be made locally that need to be ignored so that users can do pulls.
git update-indexwants the file names on its command line, not on its standard input.Step 1:
cdinto the folder you want to assume is unchangedStep 2:
You can do either this:
or
Although, with either case, file names with spaces will be problematic. If you have those, you can use this:
Edit: incorporated input from @MatthewScharley regarding
git ls-files -z.Windows Commands