Sitemap
Kelly

Kelly

Today I learned | git show

2 min readNov 21, 2024

--

Premise: You want to look at the actual changes in your most recent commit.

Press enter or click to view image in full size

We will use Aragorn’s git log to demonstrate.

$ git log

commit 45fe...b789 (HEAD -> main)
Author: Aragorn <strider@ranger.path>
Date: Sat Oct 7 12:32:10 2024 -0400

Met hobbits in Bree; guided them safely toward Rivendell

- Established watch to catch unwanted behavior
- Set up checkpoints to monitor entry points

commit 98ab...7d6f (origin/main)
Author: Aragorn <strider@ranger.path>
Date: Fri Oct 6 18:27:53 2024 -0400

Patched the codebase; no longer pursued by bugs

- Fixed vulnerabilities for secure passage
- Added layers of protection across routes

commit bc45...9f2e
Author: Aragorn <strider@ranger.path>
Date: Fri Oct 6 16:13:45 2024 -0400

Cleared path to Rivendell and optimized journey

- Reduced redundant routes
- Improved performance of primary quest functions

Get Kelly’s stories in your inbox

Join Medium for free to get updates from this writer.

Example:

git show shows the contents of the last commit.

$ git show

commit d9a8f7e92c3a4e7f8bca11d3a7d9c1f7f8231b7b (HEAD -> main)
Author: Aragorn <strider@ranger.path>
Date: Sat Oct 7 12:32:10 2024 -0400

Guided hobbits safely to Bree

- Established watch to catch unwanted behavior
- Set up checkpoints to monitor entry points

diff --git a/security.rb b/security.rb
index 3a1c8f2..d4e5f6a 100644
--- a/security.rb
+++ b/security.rb
@@ -12,7 +12,9 @@ class Security
def establish_watch
# Monitor for suspicious activity
watchers << "ranger"
- watchers << "elf"
+ watchers << "elf" unless location == "Bree" # Too conspicuous
+ watchers << "dunadan" if location == "Bree" # Blend in better
+
log "Watch established with #{watchers.count} members."
end
end

We can also use the SHA of the commit to show its diff — helpful for viewing earlier commits — or a branch name, to view the commit a specific branch is currently pointed to.

--

--