skip to content
Just Change Direction

Git add files that match a certain pattern

/ 1 min read

At work we have a lot of generated types that update as you make changes to our GQL api. This means that every time we make a change to the api, we have to commit all the generated types. Manually adding them in VSCode can be a bit of a pain, especially when you have a lot of files to add.

TIL: you can use the git add command with a pattern to add all files that match that pattern. For example, to add all files that are in a /generated/ directory you can use the following command:

Terminal window
git add \*/generated/\*

It’s a small tweak but a helpful one