一键导入
git-workflow
Git and GitHub workflow best practices. Use for commits, branches, PRs, merging, and version control operations.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Git and GitHub workflow best practices. Use for commits, branches, PRs, merging, and version control operations.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
RESTful API design best practices. Use when designing endpoints, request/response schemas, error handling, and API versioning.
Perform thorough code reviews with security, performance, and quality checks. Use when reviewing PRs, auditing code changes, or finding potential bugs.
Database design and optimization. Use for schema design, queries, migrations, indexing, and performance tuning.
Systematic debugging methodology for finding and fixing bugs. Use when investigating issues, tracing errors, or fixing production problems.
Docker and containerization best practices. Use for Dockerfile creation, docker-compose, multi-stage builds, and container optimization.
Technical documentation best practices. Use for writing READMEs, API docs, code comments, and project documentation.
| name | git-workflow |
| description | Git and GitHub workflow best practices. Use for commits, branches, PRs, merging, and version control operations. |
Git best practices for version control, branching strategies, and GitHub collaboration.
<type>(<scope>): <subject>
[optional body]
[optional footer(s)]
| Type | Description |
|---|---|
feat | New feature |
fix | Bug fix |
docs | Documentation only |
style | Formatting, no code change |
refactor | Code restructuring |
perf | Performance improvement |
test | Adding/updating tests |
chore | Maintenance tasks |
ci | CI/CD changes |
build | Build system changes |
# Feature
feat(auth): add JWT token refresh mechanism
# Bug fix
fix(proxy): resolve connection leak in upstream handler
# With body
feat(api): add rate limiting for /v1/chat endpoint
Implements token bucket algorithm with configurable
rate and burst size. Limits are per API key.
Closes #123
# Breaking change
feat(config)!: change yaml config structure
BREAKING CHANGE: config.yaml format changed.
See migration guide in docs/migration-v2.md
main (production)
│
└── develop (integration)
│
├── feature/user-auth
├── feature/dashboard
├── fix/login-bug
└── release/v1.2.0
│
└── hotfix/critical-fix → main
# Features
feature/add-user-authentication
feature/JIRA-123-dashboard-charts
# Bug fixes
fix/login-validation-error
fix/JIRA-456-memory-leak
# Releases
release/v1.2.0
release/2024-01-sprint
# Hotfixes
hotfix/critical-security-patch
# 1. Create feature branch
git checkout -b feature/my-feature develop
# 2. Make commits
git add .
git commit -m "feat: implement feature"
# 3. Push and create PR
git push -u origin feature/my-feature
# 4. Create PR via GitHub CLI
gh pr create --title "feat: implement feature" \
--body "Description of changes" \
--base develop
## Summary
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Changes Made
- Change 1
- Change 2
## Testing
- [ ] Unit tests added/updated
- [ ] Integration tests pass
- [ ] Manual testing completed
## Screenshots (if UI changes)
## Checklist
- [ ] Code follows style guidelines
- [ ] Self-reviewed
- [ ] Comments added for complex logic
- [ ] Documentation updated
# Squash merge (recommended for features)
# Combines all commits into one clean commit
gh pr merge --squash
# Merge commit (for releases)
# Preserves full history
gh pr merge --merge
# Rebase (for small changes)
# Linear history, no merge commit
gh pr merge --rebase
# Save current work
git stash save "WIP: feature description"
# List stashes
git stash list
# Apply most recent stash
git stash pop
# Apply specific stash
git stash apply stash@{2}
# Clear all stashes
git stash clear
# Interactive rebase last 5 commits
git rebase -i HEAD~5
# Rebase onto main
git rebase main
# Continue after resolving conflicts
git rebase --continue
# Abort rebase
git rebase --abort
# Apply specific commit to current branch
git cherry-pick abc123
# Cherry-pick without committing
git cherry-pick --no-commit abc123
# Cherry-pick range
git cherry-pick abc123..def456
# Undo last commit (keep changes)
git reset --soft HEAD~1
# Undo last commit (discard changes)
git reset --hard HEAD~1
# Revert a commit (creates new commit)
git revert abc123
# Restore file to last commit
git checkout -- filename
# Unstage file
git reset HEAD filename
# 1. Update your branch
git fetch origin
git rebase origin/main
# 2. If conflicts occur, resolve them
# Edit conflicting files, then:
git add resolved-file.go
git rebase --continue
# 3. Force push (if rebased)
git push --force-with-lease
<<<<<<< HEAD
Your changes
=======
Their changes
>>>>>>> feature-branch
git mergetool for complex conflicts# Pretty log
git log --oneline --graph --all
# Show changes in commits
git log -p -3
# Search commits by message
git log --grep="fix"
# Show commits by author
git log --author="name"
# Show files changed
git log --stat
# Start bisect
git bisect start
# Mark current as bad
git bisect bad
# Mark known good commit
git bisect good v1.0.0
# Git checks out middle commit, test it, then:
git bisect good # or git bisect bad
# When done
git bisect reset
# Create annotated tag
git tag -a v1.2.0 -m "Release version 1.2.0"
# Push tags
git push origin v1.2.0
git push --tags
# List tags
git tag -l "v1.*"
# Delete tag
git tag -d v1.2.0
git push origin --delete v1.2.0