| name | git-workflow |
| description | Quick reference for git operations, commit patterns, and workflow best practices |
Git Workflow Skill
Overview
This skill provides quick reference for common git operations, commit message patterns specific to this repository, and safety checklists for git workflows. Use this when you need a refresher on git commands or want to verify you're following project conventions.
Workflow Decision Tree
What do you need to do?
├─ Save work locally
│ ├─ Stage specific files → git add <files>
│ ├─ Stage all changes → git add . (check for sensitive files first!)
│ └─ Commit changes → git commit (analyze style from git log first)
│
├─ Share work with team
│ ├─ Push current branch → git push (REQUIRES user confirmation)
│ ├─ Create pull request → gh pr create (analyze full branch history first)
│ └─ Update from remote → git pull
│
├─ Manage branches
│ ├─ Create new branch → git checkout -b <name> or git switch -c <name>
│ ├─ Switch branches → git checkout <name> or git switch <name>
│ ├─ List branches → git branch -vv (shows tracking info)
│ └─ Delete branch → git branch -d <name> (confirm if unmerged)
│
├─ Review changes
│ ├─ See current status → git status
│ ├─ View uncommitted changes → git diff
│ ├─ View commit history → git log --oneline --graph
│ ├─ View file history → git log -- <file>
│ └─ Compare branches → git diff <branch1>...<branch2>
│
├─ Fix mistakes
│ ├─ Undo last commit (keep changes) → git reset --soft HEAD~1
│ ├─ Amend last commit → git commit --amend
│ ├─ Discard local changes → git restore <file> (CONFIRM first)
│ └─ Hard reset → git reset --hard (CONFIRM first - destructive!)
│
└─ Temporary storage
├─ Save work in progress → git stash push -m "description"
├─ List stashes → git stash list
├─ Apply latest stash → git stash pop
└─ Apply specific stash → git stash apply stash@{N}
Core Guidelines
Project-Specific Requirements
CRITICAL RULES:
- ❌ NEVER include
Co-Authored-By: Claude Sonnet footer in commits
- ❌ NEVER include "🤖 Generated with [Claude Code]" branding
- ⚠️ ALWAYS confirm with user before pushing to remote (
git push)
- ✅ Commits can be made freely locally
- ✅ Pushing requires explicit user approval
Commit Message Style
Based on analysis of this repository's commit history:
Format: <Action verb> <concise description>
Action Verbs:
Add - New features, files, or functionality
Fix - Bug fixes or corrections
Improve - Enhancements to existing features
Redesign - Significant UI/UX changes
Optimize - Performance improvements
Security - Security-related changes
Refactor - Code restructuring without behavior change
Update - Dependencies or configuration updates
Examples from this repo:
Add animated waveform visualization to recording indicator
Fix slow dictation transcription with enhanced logging and safety timeout
Improve waveform visualizer: fix amplitude scaling and light mode support
Redesign Meeting Transcription window and fix dictation indicator tracking
Optimize dictation latency for faster text insertion
Security: Redact transcription content from crash reports
Style Rules:
- Single line (no body unless absolutely necessary)
- Focus on what changed and why, not implementation details
- Use colon to separate component from details (optional)
- NO emojis, markdown, or special formatting
- NO attribution footers or branding
Safety Checklist
Before Staging Files:
Before Committing:
Before Pushing:
Before Destructive Operations:
Quick Reference
Common Commands
Status & Information:
git status
git status -sb
git diff
git diff --staged
git log --oneline --graph -10
git log --oneline --all --graph
git branch -vv
Staging & Committing:
git add <file>
git add <dir>
git add .
git restore --staged <file>
git commit -m "message"
git commit --amend
Branching:
git switch -c <branch>
git switch <branch>
git checkout -b <branch>
git branch -d <branch>
git branch -D <branch>
git branch -m <old> <new>
Remote Operations:
git fetch
git pull
git push
git push -u origin <branch>
git remote -v
Stashing:
git stash push -m "description"
git stash list
git stash pop
git stash apply
git stash drop
git stash clear
Undo Operations:
git restore <file>
git reset --soft HEAD~1
git reset --mixed HEAD~1
git reset --hard HEAD~1
git revert <commit>
PR Creation Checklist
When creating a pull request:
-
Analyze full branch context:
git log main..HEAD
git diff main...HEAD
git status
-
Draft PR components:
- Title: < 70 characters, descriptive
- Summary: 2-3 bullet points of what changed
- Test Plan: How to verify the changes work
- Issue link: If created from a GitHub issue, include
Closes #NNN so GitHub auto-closes the issue on merge
-
Push and create:
git push -u origin <branch>
gh pr create --title "..." --body "..."
-
PR Body Template:
## Summary
- First major change
- Second major change
- Third major change
## Test Plan
- [ ] Step 1 to test
- [ ] Step 2 to test
- [ ] Step 3 to test
Closes #NNN
Note: Replace #NNN with the actual issue number. Omit the Closes line if the PR is not associated with an issue. GitHub recognizes: Closes, Fixes, Resolves (case-insensitive).
Git Troubleshooting Guide
"I accidentally committed to the wrong branch"
git log --oneline -1
git reset --soft HEAD~1
git switch <correct-branch>
git add .
git commit -m "message"
"I need to undo my last commit"
git reset --soft HEAD~1
git reset --mixed HEAD~1
git reset --hard HEAD~1
"I want to sync with remote main"
git fetch origin
git rebase origin/main
git merge origin/main
"My branch is ahead of remote and I want to force push"
git push --force-with-lease
"I have uncommitted changes but need to switch branches"
git stash push -m "work in progress"
git switch <other-branch>
git add .
git commit -m "WIP: work in progress"
git switch <other-branch>
"I accidentally staged sensitive files"
git restore --staged .env
git restore --staged .
echo ".env" >> .gitignore
git add .gitignore
git commit -m "Add .env to .gitignore"
Safety Notes
Destructive Commands (always confirm with user):
git reset --hard - Permanently deletes uncommitted changes
git push --force - Overwrites remote history
git branch -D - Deletes unmerged branch
git clean -fd - Deletes untracked files
git stash drop - Permanently removes stashed changes
Never Use Without Explicit User Request:
--no-verify - Skips pre-commit hooks
--no-gpg-sign - Skips commit signing
--force on main/master - Can break production
Sensitive Files to Watch For:
.env, .env.local, .env.*
credentials.json, secrets.*
*.key, *.pem, *.crt
config/secrets.yml
*.sqlite, *.db (if contains sensitive data)
Philosophy
Git is powerful but unforgiving. This skill emphasizes:
- Safety first: Confirm before destructive operations
- Project compliance: Follow repository-specific rules
- Clear communication: Write commit messages for humans
- Reversibility: Prefer soft resets and reverts over hard resets
- Context awareness: Understand what you're committing and why