LoginSignup
1
0

More than 1 year has passed since last update.

git diff変更差分を確認する

Posted at

ワークツリーとステージの間の変更差分を確認するのが
git diff <ファイル名> コマンド

git addした後の変更分を確認するのがステージとリポジトリの差分を確認したいとき。
git diff --staged

git_tutorial % git diff
diff --git a/index.html b/index.html
index 470f438..6a9d330 100644
--- a/index.html
+++ b/index.html
@@ -1,3 +1,4 @@
 initial commit
 second commit
-third commit
\ No newline at end of file
+third commit
+git diff
\ No newline at end of file
git_tutorial % git add index.html
git_tutorial % git diff(ステージに移動したから何も表示されなくなる)
git_tutorial % git diff --staged(リポジトリに移動していないから変更差分が出てくる)
diff --git a/index.html b/index.html
index 470f438..6a9d330 100644
--- a/index.html
+++ b/index.html
@@ -1,3 +1,4 @@
 initial commit
 second commit
-third commit
\ No newline at end of file
+third commit
+git diff
\ No newline at end of file
git_tutorial % git commit -m diff
[master 53dd892] diff
 1 file changed, 2 insertions(+), 1 deletion(-)
git_tutorial % git diff --staged(コミットでステージに追加されたから何も出てこなくなった) 
1
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
1
0