George Kiselev
George Kiselev

Reputation: 43

Several <pathspec> in one git command

How to run git command with several pathspecs? For example, I want to look diffs of three different file extensions:

$ git diff -- *.ts | *js | *.map

Upvotes: 2

Views: 1729

Answers (1)

John Szakmeister
John Szakmeister

Reputation: 47032

You're close. Try:

git diff -- '*.ts' '*js' '*.map'

In your form, you'd be telling the shell to pipe data from git diff -- *.ts into *js (whatever happened to be picked up with that glob) and piped into *.map. That's definitely not what you want.

The form I give above is the correct way to say show me all *.ts, *js, and *.map files that have change. You need the quotes around the globs to keep the shell from expanding them, so that git can see what you are actually asking for.

Upvotes: 8

Related Questions