con un clic
git-workflow
Git branch strategy, commit conventions, and PR process for this project
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
Git branch strategy, commit conventions, and PR process for this project
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Basado en la clasificación ocupacional SOC
Debug code using detailed profiling and critical path timing before making suggestions
Workflow for investigating and fixing failing tests in this project
Making Python or TypeScript packages shareable (pip/npm)
Setup pytest with coverage reporting and watch mode for this Python project
Commands to execute tests in this project with various options and configurations
Format code according to project standards and fix linting issues
| name | git-workflow |
| description | Git branch strategy, commit conventions, and PR process for this project |
| auto-activates | ["git workflow","commit message","branch strategy","how to commit","pull request process"] |
This skill activates when you need to:
Look for documentation:
CONTRIBUTING.md - Contribution guidelines.github/PULL_REQUEST_TEMPLATE.md - PR template.github/ISSUE_TEMPLATE/ - Issue templatesREADME.md - Git workflow sectionCommon patterns to detect:
feature/, bugfix/, hotfix/Check current branch:
git branch
git status
Update main/master branch:
# Switch to main branch
git checkout main # or master
# Pull latest changes
git pull origin main
Create new branch:
Common naming conventions:
# Feature branch
git checkout -b feature/add-user-authentication
git checkout -b feature/issue-123-add-login
# Bug fix
git checkout -b bugfix/fix-login-redirect
git checkout -b fix/issue-456-memory-leak
# Hotfix (urgent production fix)
git checkout -b hotfix/security-patch-v1.2.1
# Refactor
git checkout -b refactor/improve-database-queries
# Documentation
git checkout -b docs/update-api-documentation
# Release branch
git checkout -b release/v1.2.0
Branch naming best practices:
Check changes:
git status
git diff
Stage changes:
# Stage specific files
git add file1.py file2.js
# Stage all changes
git add .
# Stage interactively
git add -p
Write commit messages:
Conventional Commits format:
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
Types:
feat: - New featurefix: - Bug fixdocs: - Documentation changesstyle: - Code style changes (formatting, no logic change)refactor: - Code refactoringtest: - Adding or updating testschore: - Maintenance tasksperf: - Performance improvementsci: - CI/CD changesExamples:
Simple commit:
git commit -m "feat: add user authentication"
With scope:
git commit -m "fix(auth): resolve login redirect issue"
With body:
git commit -m "feat(api): add rate limiting
Implements token bucket algorithm for API rate limiting.
- 100 requests per minute per API key
- Returns 429 status when limit exceeded
- Adds X-RateLimit headers to responses
Closes #123"
Breaking change:
git commit -m "feat(api)!: change authentication to OAuth2
BREAKING CHANGE: API now requires OAuth2 tokens instead of API keys.
Users must migrate to OAuth2 authentication."
Common patterns:
# Feature
git commit -m "feat: add search functionality"
# Bug fix
git commit -m "fix: resolve null pointer exception in user service"
# Documentation
git commit -m "docs: update installation instructions"
# Tests
git commit -m "test: add unit tests for authentication module"
# Refactor
git commit -m "refactor: extract validation logic into separate module"
# Performance
git commit -m "perf: optimize database queries for user lookup"
# Multiple changes (avoid this, prefer atomic commits)
git commit -m "chore: update dependencies and fix linting issues"
First push:
git push -u origin feature/my-feature
Subsequent pushes:
git push
Force push (use carefully!):
# After rebase or amend
git push --force-with-lease origin feature/my-feature
Via GitHub CLI:
# Install gh CLI if needed
# https://cli.github.com/
# Create PR
gh pr create --title "Add user authentication" --body "Implements user authentication with JWT tokens"
# With template
gh pr create --fill
# Draft PR
gh pr create --draft
Via Web UI:
PR Title best practices:
PR Description should include:
Example PR description:
## Description
Implements user authentication using JWT tokens.
## Changes
- Added authentication middleware
- Created user login/logout endpoints
- Implemented JWT token generation and validation
- Added password hashing with bcrypt
## Testing
1. Run `npm test` to execute unit tests
2. Start server and test login at POST /api/auth/login
3. Verify token is returned and can access protected routes
## Related Issues
Closes #123
Update your branch:
# Make changes based on feedback
git add .
git commit -m "refactor: improve error handling per review"
git push
Amend last commit (if needed):
# Make changes
git add .
git commit --amend --no-edit
git push --force-with-lease
Rebase to clean up history (optional):
# Interactive rebase last 3 commits
git rebase -i HEAD~3
# In editor, mark commits to squash/fixup/reword
# Save and close
# Force push
git push --force-with-lease
Rebase on main:
# Fetch latest
git fetch origin
# Rebase onto main
git rebase origin/main
# If conflicts, resolve them
git add resolved-files
git rebase --continue
# Force push
git push --force-with-lease
Merge main into your branch (alternative):
git checkout feature/my-feature
git merge main
git push
Delete local branch:
git checkout main
git branch -d feature/my-feature
Delete remote branch (usually automatic):
git push origin --delete feature/my-feature
Update local main:
git pull origin main
# 1. Create branch
git checkout main
git pull
git checkout -b feature/new-feature
# 2. Make changes and commit
git add .
git commit -m "feat: add new feature"
# 3. Push and create PR
git push -u origin feature/new-feature
gh pr create --fill
# 4. After merge
git checkout main
git pull
git branch -d feature/new-feature
# 1. Create branch from main
git checkout -b fix/issue-123-login-bug
# 2. Fix and commit
git add .
git commit -m "fix: resolve login redirect issue
Fixes #123"
# 3. Push and PR
git push -u origin fix/issue-123-login-bug
gh pr create --fill
# 1. Branch from production tag
git checkout -b hotfix/v1.2.1 v1.2.0
# 2. Fix critical issue
git add .
git commit -m "hotfix: patch security vulnerability"
# 3. Push and create urgent PR
git push -u origin hotfix/v1.2.1
gh pr create --title "URGENT: Security patch v1.2.1"
Solutions:
# 1. Update your branch
git fetch origin
git rebase origin/main
# 2. Resolve conflicts in files
# Edit files to resolve conflicts
# Look for <<<<<<, =======, >>>>>> markers
# 3. Stage resolved files
git add resolved-file.py
# 4. Continue rebase
git rebase --continue
# 5. Force push
git push --force-with-lease
Solutions:
# 1. Save changes to new branch
git branch feature/correct-branch
# 2. Reset current branch
git reset --hard origin/main
# 3. Switch to correct branch
git checkout feature/correct-branch
Solutions:
# Keep changes, undo commit
git reset --soft HEAD~1
# Discard changes and commit
git reset --hard HEAD~1
# Already pushed? Create revert commit
git revert HEAD
git push
Solutions:
# Stash your changes
git stash
# Pull latest
git pull
# Apply your changes
git stash pop
# Resolve any conflicts
# Status and info
git status
git log --oneline -10
git diff
# Branching
git checkout -b new-branch
git branch -d old-branch
# Committing
git add .
git commit -m "message"
git commit --amend
# Pushing
git push
git push --force-with-lease
# Updating
git pull
git fetch
git rebase origin/main
# Cleanup
git clean -fd
git reset --hard