← Back to list

git-workflow
by yonatangross
The Complete AI Development Toolkit for Claude Code — 159 skills, 34 agents, 20 commands, 144 hooks. Production-ready patterns for FastAPI, React 19, LangGraph, security, and testing.
⭐ 29🍴 4📅 Jan 23, 2026
SKILL.md
name: git-workflow description: Complete git workflow patterns including GitHub Flow branching, atomic commits with interactive staging, and recovery operations using reflog. Essential patterns for clean history. Use when defining branching strategy or recovering git history. context: inherit version: 1.0.0 tags: [git, branch, commit, recovery, workflow, reflog, staging] user-invocable: false
Git Workflow
Complete git workflow patterns: GitHub Flow branching, atomic commits, and recovery operations. Essential for maintaining clean, reviewable history.
Branch Naming Convention
# Feature branches (link to issue)
issue/<number>-<brief-description>
issue/123-add-user-auth
# When no issue exists
feature/<description>
fix/<description>
hotfix/<description>
Branch Rules:
mainis always deployable- Branch from
main, PR back tomain - Branches live < 1-3 days
- Delete branch after merge
Atomic Commit Checklist
[ ] Does ONE logical thing
[ ] Leaves codebase working (tests pass)
[ ] Message doesn't need "and" in title
[ ] Can be reverted independently
[ ] Title < 50 chars, body wraps at 72
Interactive Staging
# Stage changes hunk-by-hunk
git add -p
# Options:
# y - stage this hunk
# n - skip this hunk
# s - split into smaller hunks
# e - manually edit the hunk
# q - quit
# Review what's staged
git diff --staged # What will be committed
git diff # What won't be committed
Commit Patterns
# Separate concerns
git add -p && git commit -m "refactor: Extract database pool"
git add -p && git commit -m "feat(#456): Add query caching"
# Never combine unrelated changes
# BAD: "feat: Add auth and fix formatting"
# GOOD: Two separate commits
Recovery Quick Reference
The Safety Net
# ALWAYS check reflog first - it has everything
git reflog
# Shows ALL recent HEAD movements
# Even "deleted" commits live here for 90 days
Common Recovery Scenarios
| Scenario | Not Pushed | Already Pushed |
|---|---|---|
| Undo commit | git reset --soft HEAD~1 | git revert HEAD |
| Wrong branch | cherry-pick + reset | cherry-pick + revert |
| Lost commits | git reset --hard HEAD@{N} | N/A |
| Bad rebase | git rebase --abort or reflog | reflog + force-with-lease |
Quick Recovery Commands
# Undo last commit, keep changes staged
git reset --soft HEAD~1
# Find lost commits
git reflog | grep "your message"
# Recover to previous state
git reset --hard HEAD@{1}
# Safe force push (feature branches only)
git push --force-with-lease
Standard Workflow
# 1. Start fresh
git checkout main && git pull origin main
git checkout -b issue/123-my-feature
# 2. Work with atomic commits
git add -p
git commit -m "feat(#123): Add User model"
# 3. Stay updated
git fetch origin && git rebase origin/main
# 4. Push and PR
git push -u origin issue/123-my-feature
gh pr create --fill
# 5. Cleanup after merge
git checkout main && git pull
git branch -d issue/123-my-feature
Anti-Patterns
Avoid:
- Long-lived branches (> 1 week)
- Merging main into feature (use rebase)
- Direct commits to main
- Force push to shared branches
- Commits that need "and" in message
- Committing broken code
Best Practices Summary
- Branch from main - Always start fresh
- Stage interactively - Use
git add -p - One thing per commit - If you say "and", split it
- Rebase, don't merge - Keep history clean
- Check reflog first - When something goes wrong
- Force-with-lease - Safer than force push
- Delete after merge - No stale branches
Related Skills
commit- Create commits with conventional format and pre-commit validationgit-recovery-command- Quick recovery from common git mistakes using reflog operationsstacked-prs- Multi-PR development for large features with dependent PRscreate-pr- Comprehensive PR creation with proper formatting
Key Decisions
| Decision | Choice | Rationale |
|---|---|---|
| Branching model | GitHub Flow | Simple single-branch workflow, main is always deployable |
| Merge strategy | Rebase over merge | Keeps history clean and linear, easier to bisect |
| Branch naming | issue/- | Links work to tracking, enables automation |
| Commit granularity | Atomic (one thing) | Independent revert, clear history, easier review |
| Force push | --force-with-lease only | Prevents overwriting others' work on shared branches |
References
Checklists
- Branch Checklist - Pre-flight checks before creating branches
- Pre-Commit Checklist - Validation before committing
Score
Total Score
75/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
✓説明文
100文字以上の説明がある
+10
○人気
GitHub Stars 100以上
0/15
✓最近の活動
1ヶ月以内に更新
+10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
✓タグ
1つ以上のタグが設定されている
+5
Reviews
💬
Reviews coming soon
