Back to list
williballenthin

working-with-git

by williballenthin

3🍴 1📅 Jan 23, 2026

SKILL.md


name: working-with-git description: Git version control cheatsheet - viewing history, making commits, diffs, and descriptions

Working with Git

Quick reference for common Git operations used in development workflows.

Detecting Git

Check if the project uses Git:

test -d .git && echo "git" || echo "not git"

Viewing the Log

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"

Viewing Diffs

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>

Getting Commit References

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 commit
  • HEAD~1 or HEAD^ - parent commit
  • HEAD~2 - grandparent commit
  • origin/main - remote branch tip

Making Commits

Stage 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

Modifying Commit Descriptions

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)

Branch Information

Current branch:

git branch --show-current

Check if branch tracks remote:

git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null

Quick Status

See working tree status:

git status

Short status:

git status -s

Common Patterns

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>

Score

Total Score

40/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon