9
9

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基礎

Last updated at Posted at 2015-01-24

gitdiff.png

①git diffは作業ディレクトリ(working dir)とインデックス(index)の差異

②git diff [commit]は作業ディレクトリと指定されたコミット間の差異

③git diff --cached [commit]はインデックスと指定されたコミットの差異で、コミット指定しない場合はHEAD

④git diff [commit] [commit]はコミット間の差異

作業ディレクトリ(working dir)と呼ばれるものは一般的にwork treeと呼ばれる様なので追記しておきます。
また、work treeはuntrackedなファイルはdiffでは対象外。

あと、work treeからindexへはgit addで追加される。(git addでindexに追加したからといって、work treeの状態は変わらないため、
git addしたあとはgit diffでの差異は見れなくなるが、git diff commitは差異が出る

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?