Managing git skill
Manages Git workflows including branching, commits, and pull requests.
by CloudAI-X·MIT license·★ 1,416 Stars on the repo·GitHub ↗
Use now
npx degit CloudAI-X/claude-workflow-v2/skills/managing-git#main ~/.claude/skills/managing-gitChecked ·commit main
Files of Managing git
SKILL.md
Show the full text230 lines
Managing Git
When to Load
- Trigger: Branching strategies, commit workflows, pull requests, merge conflicts, version control questions
- Skip: Tasks that do not involve git operations
Feature Development Workflow
Copy this checklist and track progress:
Feature Development Progress:
- [ ] Step 1: Create feature branch from main
- [ ] Step 2: Make changes with atomic commits
- [ ] Step 3: Rebase on latest main
- [ ] Step 4: Push and create PR
- [ ] Step 5: Address review feedback
- [ ] Step 6: Merge after approval
Branching Strategies
GitHub Flow (Recommended for most projects)
main ──●────●────●────●────●── (always deployable)
\ /
feature └──●──●──┘
mainis always deployable- Feature branches from main
- PR + review + merge
- Deploy after merge
Git Flow (For release-based projects)
main ──●─────────────●────── (releases only)
\ /
release └────●────┘
/
develop ──●──●────●──●──●──
\ /
feature └──●┘
Commit Conventions
Conventional Commits Format
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
Types
| Type | Description |
|---|---|
feat |
New feature |
fix |
Bug fix |
docs |
Documentation only |
style |
Formatting, no logic change |
refactor |
Code change that neither fixes bug nor adds feature |
perf |
Performance improvement |
test |
Adding/updating tests |
chore |
Build process, dependencies |
ci |
CI configuration |
Examples
feat(auth): add OAuth2 login support
Implements Google and GitHub OAuth providers.
Closes #123
BREAKING CHANGE: Session tokens now expire after 24h
fix(api): handle null response from payment gateway
Previously caused 500 error when gateway returned null.
Now returns appropriate error message to user.
Branch Naming
<type>/<ticket-id>-<short-description>
# Examples
feature/AUTH-123-oauth-login
fix/BUG-456-null-pointer
chore/TECH-789-upgrade-deps
Pull Request Workflow
Copy this checklist when creating PRs:
PR Checklist:
- [ ] Code follows project conventions
- [ ] Tests added/updated for changes
- [ ] All tests pass locally
- [ ] No merge conflicts with main
- [ ] Documentation updated if needed
- [ ] No security vulnerabilities introduced
- [ ] PR description explains the "why"
PR Template
## Summary
[Brief description of changes]
## Changes
- [Change 1]
- [Change 2]
## Testing
- [ ] Unit tests added/updated
- [ ] Manual testing performed
- [ ] E2E tests pass
## Screenshots (if UI changes)
[Before/After screenshots]
PR Size Guidelines
| Size | Lines Changed | Review Guidance |
|---|---|---|
| XS | < 50 | Quick review |
| S | 50-200 | Standard review |
| M | 200-500 | Thorough review |
| L | 500+ | Split if possible |
Common Git Commands
Daily Workflow
# Start new feature
git checkout main
git pull
git checkout -b feature/TICKET-123-description
# Commit changes
git add path/to/file # Stage specific files (git add -p needs an interactive terminal)
git commit -m "feat: description"
# Keep up with main
git fetch origin main
git rebase origin/main
# Push and create PR
git push -u origin HEAD # after rebasing an already-pushed branch: git push --force-with-lease
Fixing Mistakes
# Amend last commit (before push)
git commit --amend
# Undo last commit (keep changes)
git reset --soft HEAD~1
# Undo last commit (discard changes)
git reset --hard HEAD~1 # also discards uncommitted changes
# Revert a pushed commit
git revert <commit-hash>
# Interactive rebase to clean up
git rebase -i HEAD~3
# Non-interactive: git commit --fixup=<sha>, then
GIT_SEQUENCE_EDITOR=: git rebase -i --autosquash HEAD~3
Advanced Operations
# Cherry-pick specific commit
git cherry-pick <commit-hash>
# Find which commit broke something
git bisect start
git bisect bad HEAD
git bisect good <known-good-commit>
# Stash with message
git stash push -m "WIP: feature description"
git stash list
git stash pop
Commit Validation
Before pushing, validate commits:
Commit Validation:
- [ ] Each commit has a clear, descriptive message
- [ ] Commit type matches the change (feat, fix, etc.)
- [ ] No WIP or temporary commits
- [ ] No secrets or credentials committed
- [ ] Changes are atomic (one logical change per commit)
If validation fails, use git rebase -i to clean up commit history (or --fixup + --autosquash when no interactive terminal is available) before pushing.
| 1 | |
| 2 | name managing-git |
| 3 | description Manages Git workflows including branching, commits, and pull requests. Use when working with Git, creating commits, opening PRs, managing branches, resolving conflicts, or when asked about version control best practices. |
| 4 | |
| 5 | |
| 6 | # Managing Git |
| 7 | |
| 8 | ### When to Load |
| 9 | |
| 10 | **Trigger**: Branching strategies, commit workflows, pull requests, merge conflicts, version control questions |
| 11 | **Skip**: Tasks that do not involve git operations |
| 12 | |
| 13 | ## Feature Development Workflow |
| 14 | |
| 15 | Copy this checklist and track progress: |
| 16 | |
| 17 | |
| 18 | Feature Development Progress: |
| 19 | - [ ] Step 1: Create feature branch from main |
| 20 | - [ ] Step 2: Make changes with atomic commits |
| 21 | - [ ] Step 3: Rebase on latest main |
| 22 | - [ ] Step 4: Push and create PR |
| 23 | - [ ] Step 5: Address review feedback |
| 24 | - [ ] Step 6: Merge after approval |
| 25 | |
| 26 | |
| 27 | ## Branching Strategies |
| 28 | |
| 29 | ### GitHub Flow (Recommended for most projects) |
| 30 | |
| 31 | |
| 32 | main ──●────●────●────●────●── (always deployable) |
| 33 | \ / |
| 34 | feature └──●──●──┘ |
| 35 | |
| 36 | |
| 37 | `main` is always deployable |
| 38 | Feature branches from main |
| 39 | PR + review + merge |
| 40 | Deploy after merge |
| 41 | |
| 42 | ### Git Flow (For release-based projects) |
| 43 | |
| 44 | |
| 45 | main ──●─────────────●────── (releases only) |
| 46 | \ / |
| 47 | release └────●────┘ |
| 48 | / |
| 49 | develop ──●──●────●──●──●── |
| 50 | \ / |
| 51 | feature └──●┘ |
| 52 | |
| 53 | |
| 54 | ## Commit Conventions |
| 55 | |
| 56 | ### Conventional Commits Format |
| 57 | |
| 58 | |
| 59 | <type>(<scope>): <description> |
| 60 | |
| 61 | [optional body] |
| 62 | |
| 63 | [optional footer(s)] |
| 64 | |
| 65 | |
| 66 | ### Types |
| 67 | |
| 68 | | Type | Description | |
| 69 | | ---------- | --------------------------------------------------- | |
| 70 | | `feat` | New feature | |
| 71 | | `fix` | Bug fix | |
| 72 | | `docs` | Documentation only | |
| 73 | | `style` | Formatting, no logic change | |
| 74 | | `refactor` | Code change that neither fixes bug nor adds feature | |
| 75 | | `perf` | Performance improvement | |
| 76 | | `test` | Adding/updating tests | |
| 77 | | `chore` | Build process, dependencies | |
| 78 | | `ci` | CI configuration | |
| 79 | |
| 80 | ### Examples |
| 81 | |
| 82 | |
| 83 | feat(auth): add OAuth2 login support |
| 84 | |
| 85 | Implements Google and GitHub OAuth providers. |
| 86 | Closes #123 |
| 87 | |
| 88 | BREAKING CHANGE: Session tokens now expire after 24h |
| 89 | |
| 90 | |
| 91 | |
| 92 | fix(api): handle null response from payment gateway |
| 93 | |
| 94 | Previously caused 500 error when gateway returned null. |
| 95 | Now returns appropriate error message to user. |
| 96 | |
| 97 | |
| 98 | ## Branch Naming |
| 99 | |
| 100 | |
| 101 | <type>/<ticket-id>-<short-description> |
| 102 | |
| 103 | # Examples |
| 104 | feature/AUTH-123-oauth-login |
| 105 | fix/BUG-456-null-pointer |
| 106 | chore/TECH-789-upgrade-deps |
| 107 | |
| 108 | |
| 109 | ## Pull Request Workflow |
| 110 | |
| 111 | Copy this checklist when creating PRs: |
| 112 | |
| 113 | |
| 114 | PR Checklist: |
| 115 | - [ ] Code follows project conventions |
| 116 | - [ ] Tests added/updated for changes |
| 117 | - [ ] All tests pass locally |
| 118 | - [ ] No merge conflicts with main |
| 119 | - [ ] Documentation updated if needed |
| 120 | - [ ] No security vulnerabilities introduced |
| 121 | - [ ] PR description explains the "why" |
| 122 | |
| 123 | |
| 124 | ### PR Template |
| 125 | |
| 126 | |
| 127 | ## Summary |
| 128 | |
| 129 | [Brief description of changes] |
| 130 | |
| 131 | ## Changes |
| 132 | |
| 133 | - [Change 1] |
| 134 | - [Change 2] |
| 135 | |
| 136 | ## Testing |
| 137 | |
| 138 | - [ ] Unit tests added/updated |
| 139 | - [ ] Manual testing performed |
| 140 | - [ ] E2E tests pass |
| 141 | |
| 142 | ## Screenshots (if UI changes) |
| 143 | |
| 144 | [Before/After screenshots] |
| 145 | |
| 146 | |
| 147 | ### PR Size Guidelines |
| 148 | |
| 149 | | Size | Lines Changed | Review Guidance | |
| 150 | | ---- | ------------- | ----------------- | |
| 151 | | XS | < 50 | Quick review | |
| 152 | | S | 50-200 | Standard review | |
| 153 | | M | 200-500 | Thorough review | |
| 154 | | L | 500+ | Split if possible | |
| 155 | |
| 156 | ## Common Git Commands |
| 157 | |
| 158 | ### Daily Workflow |
| 159 | |
| 160 | |
| 161 | # Start new feature |
| 162 | git checkout main |
| 163 | git pull |
| 164 | git checkout -b feature/TICKET-123-description |
| 165 | |
| 166 | # Commit changes |
| 167 | git add path/to/file # Stage specific files (git add -p needs an interactive terminal) |
| 168 | git commit -m "feat: description" |
| 169 | |
| 170 | # Keep up with main |
| 171 | git fetch origin main |
| 172 | git rebase origin/main |
| 173 | |
| 174 | # Push and create PR |
| 175 | git push -u origin HEAD # after rebasing an already-pushed branch: git push --force-with-lease |
| 176 | |
| 177 | |
| 178 | ### Fixing Mistakes |
| 179 | |
| 180 | |
| 181 | # Amend last commit (before push) |
| 182 | git commit --amend |
| 183 | |
| 184 | # Undo last commit (keep changes) |
| 185 | git reset --soft HEAD~1 |
| 186 | |
| 187 | # Undo last commit (discard changes) |
| 188 | git reset --hard HEAD~1 # also discards uncommitted changes |
| 189 | |
| 190 | # Revert a pushed commit |
| 191 | git revert <commit-hash> |
| 192 | |
| 193 | # Interactive rebase to clean up |
| 194 | git rebase -i HEAD~3 |
| 195 | # Non-interactive: git commit --fixup=<sha>, then |
| 196 | GIT_SEQUENCE_EDITOR=: git rebase -i --autosquash HEAD~3 |
| 197 | |
| 198 | |
| 199 | ### Advanced Operations |
| 200 | |
| 201 | |
| 202 | # Cherry-pick specific commit |
| 203 | git cherry-pick <commit-hash> |
| 204 | |
| 205 | # Find which commit broke something |
| 206 | git bisect start |
| 207 | git bisect bad HEAD |
| 208 | git bisect good <known-good-commit> |
| 209 | |
| 210 | # Stash with message |
| 211 | git stash push -m "WIP: feature description" |
| 212 | git stash list |
| 213 | git stash pop |
| 214 | |
| 215 | |
| 216 | ## Commit Validation |
| 217 | |
| 218 | Before pushing, validate commits: |
| 219 | |
| 220 | |
| 221 | Commit Validation: |
| 222 | - [ ] Each commit has a clear, descriptive message |
| 223 | - [ ] Commit type matches the change (feat, fix, etc.) |
| 224 | - [ ] No WIP or temporary commits |
| 225 | - [ ] No secrets or credentials committed |
| 226 | - [ ] Changes are atomic (one logical change per commit) |
| 227 | |
| 228 | |
| 229 | If validation fails, use `git rebase -i` to clean up commit history (or `--fixup` + `--autosquash` when no interactive terminal is available) before pushing. |
| 230 |
Discussion
Alternatives
Browse more free Claude skills or everything in Development.