If I already the hash of the commit, and need to know which files are added, which are modified and which are deleted at this commit, what should I do?
Let me be specific. In commit 6128373
, added1.txt
was newly added, modified.txt
was modified and deleted.txt
was deleted.
I tried git show
, and the output is below. It does have what I want, but there are too much unwanted detail, like line-to-line differences.
$ git show 6128373
commit 61283738b68b3e9e8d06dc5b9fdb722a43fe33cb (HEAD -> master)
Date: Wed Jun 23 17:35:17 2021 +0800
add modify delete
diff --git a/added1.txt b/added1.txt
new file mode 100644
index 0000000..53bf775
--- /dev/null
+++ b/added1.txt
@@ -0,0 +1 @@
+added
\ No newline at end of file
diff --git a/deleted.txt b/deleted.txt
deleted file mode 100644
index e69de29..0000000
diff --git a/modified.txt b/modified.txt
index d8263ee..1234e84 100644
--- a/modified.txt
+++ b/modified.txt
@@ -1 +1,2 @@
-2
\ No newline at end of file
+2
+3
\ No newline at end of file
I tried git log 6128373
, and the output is below. It does not have what I want, and it shows commits that I don't care about.
commit 61283738b68b3e9e8d06dc5b9fdb722a43fe33cb (HEAD -> master)
Author:
Date: Wed Jun 23 17:35:17 2021 +0800
add modify delete
commit 044e02554997346accf215b3c8022e15751973d9
Author:
Date: Wed Jun 23 17:34:42 2021 +0800
a
...
...
I tried
$ git diff --name-only 6128373~ 6128373
added1.txt
deleted.txt
modified.txt
and it doesn't show which files are added|deleted|modified