Display the list of files changed in a commit

You can use “git diff-tree –no-commit-id –name-only -r <commit number>” to display the list of files changed in a particular commit. Let us see the same in a real-world system.

Here, “git show” shows all the details of a specific commit. You can observe two changed files in this commit.

~/repoone$ git show 453424
commit 453424edeed5c7c668cf7ce5d9f3b4ccb9aa566e
Author: paperspace <Code Version Master>
Date:   Sun Sep 4 17:43:08 2022 +0000

    This is first commit

diff --git a/dirone/fileone b/dirone/fileone
new file mode 100644
index 0000000..c2a1599
--- /dev/null
+++ b/dirone/fileone
@@ -0,0 +1 @@
+this is file one
diff --git a/filetwo b/filetwo
new file mode 100644
index 0000000..f8156fa
--- /dev/null
+++ b/filetwo
@@ -0,0 +1 @@
+this is file two

You can retrieve the information of the list of files changed as shown using “git diff-tree –no-commit-id –name-only -r” on the commit number.

~/repoone$ git diff-tree --no-commit-id --name-only -r 453424
dirone/fileone
filetwo