LoginSignup
0
0

More than 1 year has passed since last update.

あるコミットで何をしたかを見る

Posted at

git show

直近のコミット(HEADが指しているコミット)の情報を表示する。

********@mbp training % git show
commit ************************* (HEAD -> master)
Author: ******* <******************>
Date:   Sun Jun 12 16:39:42 2022 +0900

    演習課題 hello.txtを新しくコミットする

diff --git a/hello.txt b/hello.txt
new file mode 100644
index 0000000..10ddd6d
--- /dev/null
+++ b/hello.txt
@@ -0,0 +1 @@
+Hello!

直近のコミット名、hello.txtのファイルを作成,Hello!の追加されたことがわかる。

*************@mbp training % git show HEAD^
commit ****************
Author: ******* <**************>
Date:   Sun Jun 12 16:37:50 2022 +0900

    演習課題 RAEDME.mdを修正

diff --git a/README.md b/README.md
index *****************
--- a/README.md
+++ b/README.md
@@ -1 +1,3 @@
-this is a test project.
+This is a test project for Git.
+Contents:

+* hello.txt

HEAD^と指定すると直近のコミットよりひとつ前のコミットの情報を表示できる。

演習

***********@mbp training % git show HEAD^
commit **************
Author: ****** <************>
Date:   Sun Jun 12 16:37:50 2022 +0900

    演習課題 RAEDME.mdを修正

diff --git a/README.md b/README.md
index *****************
--- a/README.md
+++ b/README.md
@@ -1 +1,3 @@
-this is a test project.
+This is a test project for Git.
+Contents:
+* hello.txt
*********@mbp training % git show ********
commit ************
Author: ******* <************>
Date:   Sun Jun 12 16:37:50 2022 +0900

    演習課題 RAEDME.mdを修正

diff --git a/README.md b/README.md
index *************
--- a/README.md
+++ b/README.md
@@ -1 +1,3 @@
-this is a test project.
+This is a test project for Git.
+Contents:
+* hello.txt

ハッシュ値でも呼び出せた。
表示内容が同じことがわかる。

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