Skip to content

Instantly share code, notes, and snippets.

@hed0rah
Created May 11, 2026 13:55
Show Gist options
  • Select an option

  • Save hed0rah/1db4d11e0a4f70fed24bcbf04c18006d to your computer and use it in GitHub Desktop.

Select an option

Save hed0rah/1db4d11e0a4f70fed24bcbf04c18006d to your computer and use it in GitHub Desktop.
git Explore

Git Log Exploration Cheatsheet

Ultimate All-in-One (Graph, Full Message/MR Description, and Code Diff)

git log --graph --patch --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset%n%n%w(80,2,2)%B%n'

Search Commit Messages for Specific Keywords

git log --grep="search term"

Find Commits that Added or Removed Specific Code Strings

git log -S"code_snippet"

Filter History by Author

git log --author="Name"

View Commits Within a Specific Date Range

git log --since="1 week ago" --until="yesterday"

See History for a Specific File Only

git log --follow -p -- "path/to/file"

Compare Differences Between Two Branches

git log branchA..branchB --oneline --graph

Summary of Changed Files and Line Counts (No Diff)

git log --stat

View the Last N Commits with Full Descriptions

git log -n 5 --pretty=format:'%h %s%n%b'

List Commits Excluding Merge Commits

git log --no-merges --oneline

Show Details and Diff of a Single Specific Commit

git show <commit_hash>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment