Is there negation syntax for git add's filepattern?

A pure Git way would be to add them all and then remove those files you don’t want from the index again:

git add .
git rm --cached *.hi

The --cached is required to remove them only from the index; otherwise you would delete those files. Note that git rm will always “add a removal” to the index, so this is probably not what you want in case the files are tracked. Then you should use git reset as Klas Mellbourn suggested in the comments:

git add .
git reset -- *.hi

In PowerShell, this works:

git add $(Get-ChildItem -Recurse -Exclude '*.hi')

Tags:

Git