Search code examples
git

Can I get a list of files marked --assume-unchanged?


What have I marked as --assume-unchanged? Is there any way to find out what I've tucked away using that option?

I've dug through the .git/ directory and don't see anything that looks like what I'd expect, but it must be somewhere. I've forgotten what I marked this way a few weeks ago and now I need to document those details for future developers.


Solution

  • You can use git ls-files -v. If the character printed is lower-case, the file is marked assume-unchanged.

    To print just the files that are unchanged use:

    git ls-files -v | grep '^[[:lower:]]'
    

    To embrace your lazy programmer, turn this into a git alias. Edit your .gitconfig file to add this snippet:

    [alias]
        ignored = !git ls-files -v | grep "^[[:lower:]]"
    

    Now typing git ignored will give you output like this:

    h path/to/ignored.file
    h another/ignored.file