| name | git-master |
| description | Git operations mastery. Atomic commits, rebase/squash, history search (blame, bisect, log -S). Triggers on 'commit', 'rebase', 'squash', 'who wrote', 'when was X added', 'find the commit that'. |
Git Master Skill
When to Load This Skill
- Creating commits (atomic, well-messaged)
- Rebasing or squashing commits
- History search (blame, bisect, log -S)
- Finding "who wrote" or "when was X added"
- Any complex git operations
Atomic Commits
Each commit should be:
- Single purpose - one logical change
- Self-contained - builds and tests pass
- Well-messaged - explains WHY, not just WHAT
Commit Message Format
<type>(<scope>): <subject>
<body - optional, explains WHY>
<footer - optional, references issues>
Types: feat, fix, docs, style, refactor, test, chore
Examples
git commit -m "feat(auth): add JWT refresh token support
Enables seamless token refresh without user re-authentication.
Tokens refresh 5 minutes before expiration.
Closes #123"
git commit -m "fixed stuff"
git commit -m "WIP"
git commit -m "update"
History Search
Find Who Wrote a Line
git blame <file>
git blame -L 10,20 <file>
git blame -w <file>
Find When Code Was Added
git log --grep="keyword"
git log -S "function_name"
git log -S "exact string" --all
git log -G "pattern.*regex"
Find Bug Introduction (Bisect)
git bisect start
git bisect bad HEAD
git bisect good <known-good-commit>
git bisect good
git bisect bad
git bisect reset
Interactive Rebase
Squash Recent Commits
git rebase -i HEAD~3
In editor, change pick to:
squash (s) - combine with previous, keep message
fixup (f) - combine with previous, discard message
reword (r) - change commit message
edit (e) - stop to amend
drop (d) - delete commit
Rebase onto Base Branch
git fetch origin
git rebase origin/<base-branch>
git add <file>
git rebase --continue
Replace <base-branch> with the repository's actual target branch.
Safety Rules (CRITICAL)
| Action | Safety |
|---|
git commit | Safe |
git commit --amend | Safe if NOT pushed |
git rebase | Safe if NOT pushed |
git push --force | ⚠️ DESTRUCTIVE - ask first |
git reset --hard | ⚠️ DESTRUCTIVE - ask first |
NEVER force push to main/master without explicit user approval.
Common Workflows
Amend Last Commit (Not Pushed)
git add <files>
git commit --amend --no-edit
git commit --amend -m "new message"
Undo Last Commit (Keep Changes)
git reset --soft HEAD~1
Stash Work in Progress
git stash
git stash pop
git stash list
git stash drop stash@{0}
Create Feature Branch
git checkout -b feature/my-feature
git push -u origin feature/my-feature
Pull Request Workflow
git fetch origin
git rebase origin/<base-branch>
git push -u origin feature/my-feature
gh pr create --title "feat: description" --body "## Summary
- Change 1
- Change 2"
Again, replace <base-branch> with the repository's real PR target branch.