If you want to check (undo changes) of uninstalled modified files that match a given template, this works:
MacOS:
git checkout $(git st -s | sed -E 's/^.{2}//' | grep '\.foo$')
Unix:
git checkout $(git st -s | sed -r 's/^.{2}//' | grep '\.foo$')
I tested this with only M modified files. YMMV if you also renamed / deleted / conflicted files.
Johannes Fahrenkrug
source share