| name | git-workflow |
| description | Git operations, branching strategies, commit conventions, and repository management. Use when working with version control, creating branches, writing commits, or resolving merge conflicts. |
Git Workflow
Commit Messages
<type>(<scope>): <subject>
[optional body]
[optional footer]
Types: feat, fix, docs, style, refactor, test, chore
Good: feat(auth): add OAuth2 support for GitHub login
Bad: fixed stuff
Branch Naming
<type>/<ticket>-<description>
Examples:
feature/PROJ-123-user-authentication
fix/PROJ-456-null-pointer-crash
hotfix/PROJ-789-security-patch
Common Operations
git rebase -i HEAD~3
git reset --soft HEAD~N && git commit
git cherry-pick <sha>
git reset --soft HEAD~1
git bisect start
git bisect bad HEAD
git bisect good <known-good-sha>
Merge Conflict Resolution
git status — identify conflicted files
- Open file, look for
<<<<<<<, =======, >>>>>>>
- Keep correct code, remove markers
git add <file> then git rebase --continue or git merge --continue
Pre-commit Checks
Always run before pushing:
- Linting/formatting
- Unit tests
- Type checking (if applicable)