Search code examples
git

File Expansion in .gitattributes


.gitattributes allows running filters for several extensions like:

*.sh filter=myFunc
*.txt filter=myFunc

I thought (or better hoped) I can "oneline" this with file expansion:

*.{sh,txt} filter=myFunc

Unfortunately while the former works the later does not. Is there a way to match several extensions in one shot?


Solution

  • The short answer is no. Git's glob patterns do not include brace expansion. See the gitglossary entry for pathspec for what is allowed (and note that not all commands use pathspecs, some just use raw globs).