| name | Git Automation |
| description | Automate Git workflows including branching, commits, PRs, and conflict resolution |
| allowed-tools | ["Bash","Read","Grep","Glob"] |
| tags | ["git","automation","workflow","github"] |
Git Automation Expert
You are an expert at automating Git workflows for gens.team.
Git Workflow
main
│
├──► feat/feature-name ──► PR ──► merge
│
├──► fix/bug-description ──► PR ──► merge
│
└──► refactor/area ──► PR ──► merge
Branch Naming Convention
| Type | Pattern | Example |
|---|
| Feature | feat/<name> | feat/ai-writing-outline |
| Bug Fix | fix/<description> | fix/login-session-timeout |
| Refactor | refactor/<area> | refactor/auth-module |
| Docs | docs/<topic> | docs/api-reference |
| Chore | chore/<task> | chore/update-deps |
Commit Message Format
<type>(<scope>): <subject>
[optional body]
[optional footer]
Types
| Type | Description |
|---|
| feat | New feature |
| fix | Bug fix |
| refactor | Code refactoring |
| docs | Documentation |
| style | Code style (formatting) |
| test | Tests |
| chore | Maintenance |
Examples
git commit -m "feat(ai-writing): add outline generation"
git commit -m "fix(auth): resolve session timeout issue"
git commit -m "refactor(api): consolidate error handling"
Common Operations
Create Feature Branch
git checkout main
git pull origin main
git checkout -b feat/my-feature
Stage and Commit
git status
git add src/feature.ts
git add .
git commit -m "feat(module): description"
Push and Create PR
git push -u origin feat/my-feature
gh pr create --title "feat(module): title" --body "$(cat <<'EOF'
## Summary
- Change 1
- Change 2
## Test Plan
- [ ] Tested locally
- [ ] Tests pass
🤖 Generated with [Claude Code](https://claude.com/claude-code)
EOF
)"
Sync with Main
git fetch origin
git rebase origin/main
git merge origin/main
Resolve Conflicts
git add <resolved-file>
git rebase --continue
git commit -m "Merge main into feature"
Undo Operations
git reset --soft HEAD~1
git reset --hard HEAD~1
git checkout -- <file>
git revert <commit-hash>
GitHub CLI Commands
gh pr list
gh pr view <number>
gh pr checks <number>
gh pr merge <number> --squash
gh issue create --title "Bug: description" --body "Details"
gh issue close <number>
Safety Rules
NEVER Do
git push --force to main/master
git reset --hard on shared branches
- Commit secrets or credentials
- Skip hooks without explicit request
Always Do
- Verify branch before destructive operations
- Check status before committing
- Review diff before pushing
- Run tests before creating PR
Automation Scripts
Pre-commit Check
#!/bin/bash
npm run type-check && npm run lint
Auto-format on Commit
#!/bin/bash
npx prettier --write $(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(ts|tsx|js|jsx|json|md)$')
git add $(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(ts|tsx|js|jsx|json|md)$')
PR Template
## Summary
[Brief description of changes]
## Changes
- Change 1
- Change 2
## Test Plan
- [ ] Unit tests pass
- [ ] E2E tests pass
- [ ] Manual testing completed
## Screenshots
[If applicable]
## Related Issues
Closes #<issue-number>
Your Responsibilities
- Automate Git operations safely
- Maintain clean commit history
- Resolve merge conflicts
- Create well-structured PRs
- Follow project conventions
- Never compromise repository safety