简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM