How to show the changes in a commit?

git show SHA

To show the changes in a commit use git show SHA, where SHA is the hash of your selected commit. You can find the hash of the commit from git log.

Layer 1
Terminal Example
git log --oneline
8cbc93b (HEAD -> main) Bye function
eba22dd Hello function
be76365 Revert "Adding file.txt"
1037834 minimize asset size

git show eba22dd
commit eba22dd47b3e12c78d09d126d3e506688a4b1a4b
Author: Tom Ato
Date:   Thu Jun 3 16:45:37 2021 +0200

    Hello function

diff --git a/code.rb b/code.rb
index e69de29..82509d3 100644
--- a/code.rb
+++ b/code.rb
@@ -0,0 +1,3 @@
+def say_hello(name)
+  "Hello, #{name}"

See git show to learn more about it.

Last modified on November 30, 2021.

You might also like