Git version control cheatsheet - viewing history, making commits, diffs, and descriptions
Inherits all available tools
Additional assets for this skill
This skill inherits all available tools. When active, it can use any tool Claude has access to.
Quick reference for common Git operations used in development workflows.
Check if the project uses Git:
test -d .git && echo "git" || echo "not git"
Show recent commits:
git log --oneline -10
Show log with graph:
git log --oneline --graph --all -10
Show specific commit:
git log -1 <commit-sha>
Find commits by message:
git log --oneline --grep="keyword"
See uncommitted changes:
git diff
See staged changes:
git diff --cached
Diff between commits:
git diff <base-sha>..<head-sha>
Diff stats:
git diff --stat <base-sha>..<head-sha>
Show what changed in a commit:
git show <commit-sha>
Current commit SHA:
git rev-parse HEAD
Parent commit SHA:
git rev-parse HEAD~1
Branch's remote tracking commit:
git rev-parse origin/main
Relative references:
HEAD - current commitHEAD~1 or HEAD^ - parent commitHEAD~2 - grandparent commitorigin/main - remote branch tipStage and commit:
git add <files>
git commit -m "commit message"
Commit all tracked changes:
git commit -am "commit message"
Stage specific hunks interactively:
git add -p
Amend last commit message:
git commit --amend -m "new message"
Amend last commit (open editor):
git commit --amend
Change older commit messages (interactive rebase):
git rebase -i HEAD~3
(Then mark commits with reword in the editor)
Current branch:
git branch --show-current
Check if branch tracks remote:
git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null
See working tree status:
git status
Short status:
git status -s
Get range for code review:
BASE_SHA=$(git rev-parse HEAD~1)
HEAD_SHA=$(git rev-parse HEAD)
echo "Reviewing: $BASE_SHA..$HEAD_SHA"
Compare against main:
git diff origin/main..HEAD
See files changed:
git diff --name-only <base>..<head>