2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

git diff でワイルドカード使ってパスを省略する方法

Posted at

指定したファイルのみを git add したい場合に hogehoge/hoge/hoge.js がフルパスだとしたら

$ git add *hoge.js

と入力を省略できますが、

git diff で対象ファイルの差分を見たい場合に

$ git diff *hoge.js

だと

fatal: ambiguous argument '*hoge.js': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:

と怒られます。

なので2行目の指摘どおりに

$ git diff -- *hoge.js

とすることで楽して対象ファイルの diff が取れます。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?