0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

git diff

Posted at

git diff とは

commits, commit, working treeなどの間の変更を表示する

Comparing with arbitrary commits

git diff main

現在のbranchmainbranchを比較する

--name-only

> git diff --name-only main
a.txt
b.txt
c.txt

変更されたファイルの名前のみを表示する

--name-status

> git diff --name-status main
M       a.txt
D       b.txt
A       c.txt

変更されたファイルの名前と状態のみを表示する

--diff-filter=[(A|C|D|M|R|T|U|X|B)…​[*]]

指定したファイルの変更状態のみを表示する

  • A:Added
  • D:Deleted
  • M:Modified
  • R:Renamed

なお、大文字は指定、小文字は指定しない

upper-case letters
> git diff --diff-filter=AM --name-status  main
M       a.txt
A       c.txt
lower-case letters
> git diff --diff-filter=a --name-status  main
M       a.txt
D       b.txt

Reference

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?