git-workflow
Git Workflow Skill
Instructions
When using Git:
1. Commit Messages
Format:
type(scope): short description
Longer description if needed. Explain what and why,
not how (code shows how).
Closes #123
Types:
feat: New featurefix: Bug fixdocs: Documentation onlystyle: Formatting, no code changerefactor: Code change without feature/fixperf: Performance improvementtest: Adding/fixing testschore: Build, CI, dependencies
Examples:
git commit -m "feat(auth): add password reset functionality"
git commit -m "fix(cart): resolve quantity update issue"
git commit -m "docs(readme): update installation instructions"
git commit -m "refactor(api): simplify error handling"
2. Branch Naming
Format: type/description
# Features
git checkout -b feature/user-authentication
git checkout -b feature/payment-gateway
# Bugs
git checkout -b fix/login-redirect
git checkout -b bugfix/cart-total
# Hotfixes
git checkout -b hotfix/security-patch
# Releases
git checkout -b release/v2.0.0
3. Common Workflows
Feature Development:
# Start from latest main
git checkout main
git pull origin main
# Create feature branch
git checkout -b feature/new-feature
# Work and commit
git add .
git commit -m "feat: implement new feature"
# Keep up to date
git fetch origin
git rebase origin/main
# Push and create PR
git push -u origin feature/new-feature
Quick Fix:
git checkout main
git pull
git checkout -b fix/quick-fix
# Make changes
git add .
git commit -m "fix: resolve issue"
git push -u origin fix/quick-fix
4. Useful Commands
# Status and logs
git status
git log --oneline -10
git log --graph --oneline --all
# Stashing
git stash
git stash list
git stash pop
git stash apply stash@{0}
# Undoing changes
git checkout -- file.txt # Discard changes
git reset HEAD file.txt # Unstage
git reset --soft HEAD~1 # Undo commit, keep changes
git reset --hard HEAD~1 # Undo commit, discard changes
# Interactive rebase (clean up commits)
git rebase -i HEAD~3
# Cherry pick
git cherry-pick <commit-hash>
# View differences
git diff # Unstaged changes
git diff --staged # Staged changes
git diff main..feature-branch # Between branches
5. Pull Request Template
## Summary
Brief description of changes.
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Changes Made
- Change 1
- Change 2
- Change 3
## Testing
- [ ] Tested locally
- [ ] Added/updated tests
- [ ] All tests passing
## Screenshots (if applicable)
## Checklist
- [ ] Code follows project style
- [ ] Self-reviewed the code
- [ ] Commented complex logic
- [ ] Updated documentation
- [ ] No new warnings
6. Resolving Conflicts
# During merge/rebase
git status # See conflicted files
# Edit files to resolve conflicts
# Look for: <<<<<<< HEAD, =======, >>>>>>> branch
# After resolving
git add <resolved-files>
git rebase --continue # If rebasing
git merge --continue # If merging
# Abort if needed
git rebase --abort
git merge --abort
7. Tagging Releases
# Create annotated tag
git tag -a v1.0.0 -m "Release version 1.0.0"
# Push tags
git push origin v1.0.0
git push origin --tags
# List tags
git tag -l "v1.*"
# Delete tag
git tag -d v1.0.0
git push origin --delete v1.0.0
8. Git Aliases
# Add to ~/.gitconfig
[alias]
st = status
co = checkout
br = branch
ci = commit
lg = log --oneline --graph --all
last = log -1 HEAD
unstage = reset HEAD --
amend = commit --amend --no-edit
9. .gitignore Essentials
# Dependencies
node_modules/
vendor/
# Build output
dist/
build/
*.min.js
*.min.css
# Environment
.env
.env.local
*.local
# IDE
.idea/
.vscode/
*.swp
# OS
.DS_Store
Thumbs.db
# Logs
*.log
npm-debug.log*
# WordPress specific
wp-config.php
wp-content/uploads/
wp-content/upgrade/
10. Best Practices
- Commit early, commit often
- Write meaningful commit messages
- Keep commits focused (one change per commit)
- Pull before push
- Never commit secrets/credentials
- Use branches for features
- Review before merging
- Keep main/master deployable
- Delete merged branches
- Use .gitignore properly
More from vapvarun/claude-backup
php
Modern PHP development best practices including PHP 8.x features, OOP patterns, error handling, security, testing, and performance optimization. Use when writing PHP code, reviewing PHP projects, debugging PHP issues, or implementing PHP features outside of WordPress/Laravel specific contexts.
45email-marketing
Create email marketing campaigns including newsletters, drip sequences, promotional emails, and transactional emails. Use when writing email copy, designing email templates, or planning email automation.
14html-markup
Write semantic, accessible HTML5 markup following best practices for structure, SEO, and accessibility. Use when creating HTML templates, fixing markup issues, or building web page structures.
12landing-page
Create high-converting landing pages with persuasive copy, clear CTAs, social proof, and optimized structure. Use when building sales pages, product pages, lead capture pages, or conversion-focused pages.
12marketing
Create comprehensive marketing content for themes, plugins, and web products. Generates organized folder structure with product descriptions, feature highlights, social media posts, email campaigns, video scripts, sales materials, and brand assets. Use when creating promotional content, announcements, or sales copy.
11react-component
Create React components with TypeScript, following best practices for hooks, state management, accessibility, and testing. Use when building new UI components or refactoring existing ones.
11