Resource/other-skills/skills/git-workflow/SKILL.md
Git workflow best practices and patterns. Use this skill when working with git operations, creating commits, managing branches, handling pull requests, or establishing team git workflows. Provides guidance on commit messages, branching strategies, and collaboration patterns.
npx skillsauth add chlmm/changex-notes git-workflowInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill provides comprehensive git workflow best practices, branching strategies, and collaboration patterns. Use it to ensure consistent, professional git usage across your projects.
Visual workflow guides for common Git operations:
| Workflow | Description | Frequency | File | |----------|-------------|-----------|------| | Overview | Git 全流程全景图 | - | workflows/overview.md | | Basic Commit | 从修改到推送的基础流程 | ⭐⭐⭐⭐⭐ | workflows/basic-commit.md | | Branch Collaboration | 特性分支团队协作 | ⭐⭐⭐⭐⭐ | workflows/branch-collaboration.md | | Code Review | 现代团队代码审查流程 | ⭐⭐⭐⭐⭐ | workflows/code-review.md | | Merge Conflict | 解决代码冲突 | ⭐⭐⭐⭐ | workflows/merge-conflict.md | | Undo Operations | 撤销修改和回退 | ⭐⭐⭐⭐ | workflows/undo-operations.md | | Release & Tagging | 版本发布和热修复 | ⭐⭐⭐⭐ | workflows/release-tagging.md | | Rebase Workflow | 使用 rebase 保持历史整洁 | ⭐⭐⭐ | workflows/rebase-workflow.md | | Submodule | 子模块管理 | ⭐⭐ | workflows/submodule.md | | Disaster Recovery | 误操作数据恢复 | ⭐ | workflows/disaster-recovery.md |
Follow the Conventional Commits specification for clear, semantic commit messages:
Format:
<type>(<scope>): <subject>
<body>
<footer>
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Formatting, missing semicolons, etc.refactor: Code restructuring without behavior changesperf: Performance improvementstest: Adding or updating testschore: Build process, dependencies, toolingci: CI/CD pipeline changesExamples:
feat(auth): add JWT token refresh mechanism
Implement automatic token refresh before expiration.
Tokens are refreshed 5 minutes before expiry.
Closes #123
fix(api): handle null responses in user service
Add defensive null checks to prevent NPE when
external API returns unexpected null values.
Fixes #456
Best for: Scheduled releases, multiple version support
Branches:
main: Production-ready codedevelop: Integration branch for featuresfeature/*: New featuresrelease/*: Release preparationhotfix/*: Emergency production fixesWorkflow:
# Start new feature
git checkout develop
git checkout -b feature/user-authentication
# Finish feature
git checkout develop
git merge feature/user-authentication
git branch -d feature/user-authentication
# Create release
git checkout -b release/1.2.0
# Bump version, final testing
git checkout main
git merge release/1.2.0
git tag -a v1.2.0 -m "Release 1.2.0"
git checkout develop
git merge release/1.2.0
Best for: Continuous deployment, web applications
Branches:
main: Always deployablefeature/*: All changesWorkflow:
# Start work
git checkout -b feature/add-dark-mode
# Make changes, commit often
git commit -m "feat(ui): add dark mode toggle"
# Push and create PR
git push origin feature/add-dark-mode
# Create pull request on GitHub
# After review and CI passes, merge to main
# Deploy from main
Best for: High-frequency releases, mature CI/CD
Key principles:
main or very short-lived feature branches (<1 day)PR Description Template:
## Summary
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing Done
- [ ] Unit tests added/updated
- [ ] Integration tests pass
- [ ] Manual testing completed
## Screenshots (if applicable)
## Related Issues
Closes #123
Review Checklist:
Process:
# Update your branch with latest main
git checkout feature/my-feature
git fetch origin
git merge origin/main
# If conflicts occur
# 1. Open conflicted files
# 2. Look for conflict markers: <<<<<<< ======= >>>>>>>
# 3. Resolve manually, keeping appropriate changes
# 4. Remove conflict markers
# 5. Test the resolved code
git add <resolved-files>
git commit -m "chore: resolve merge conflicts with main"
Conflict Resolution Tips:
git mergetool for complex conflictsCommon hooks to consider:
pre-commit:
# Run linters, formatters
npm run lint
npm run format
# Run fast tests
npm run test:unit
commit-msg:
# Validate commit message format
# Ensure conventional commits compliance
pre-push:
# Run full test suite
npm run test
# Run build
npm run build
Use Rebase When:
git fetch origin
git rebase origin/main
Use Merge When:
git merge origin/main
Use to apply specific commits to another branch:
# Find commit hash
git log
# Apply to current branch
git cherry-pick <commit-hash>
Clean up commit history before pushing:
# Rebase last 3 commits
git rebase -i HEAD~3
# Options: pick, reword, squash, fixup, drop
git reset --soft HEAD~1 # Keep changes staged
git reset HEAD~1 # Keep changes unstaged
git reset --hard HEAD~1 # Discard changes
# Create new commit that reverses changes
git revert <commit-hash>
git push origin main
# Save work in progress
git stash save "WIP: feature description"
# List stashes
git stash list
# Apply stash
git stash apply stash@{0}
# Apply and remove
git stash pop
# Last commit (not pushed)
git commit --amend -m "new message"
# Older commit
git rebase -i HEAD~n # Use 'reword'
This skill includes reference documentation for deeper dives:
Daily Commands:
git status # Check status
git add <file> # Stage file
git commit -m "message" # Commit with message
git push origin <branch> # Push to remote
git pull origin <branch> # Pull from remote
git checkout -b <branch> # Create and switch branch
git merge <branch> # Merge branch
Inspection:
git log --oneline --graph # Visual commit history
git diff # See unstaged changes
git diff --staged # See staged changes
git show <commit> # Show commit details
git blame <file> # See who changed each line
Cleanup:
git branch -d <branch> # Delete local branch
git push origin :<branch> # Delete remote branch
git clean -fd # Remove untracked files
git gc # Garbage collection
tools
Windows CMD 命令行使用指南。提供文件操作、目录管理、网络诊断、系统管理等完整命令参考。
tools
ZeroTier - 虚拟局域网工具。创建虚拟网络,实现设备间安全互联,类似 VPN 但更轻量。
tools
Xunlong - 书签管理工具。简洁高效的书签管理和同步方案。
tools
Watcharr - 影视进度管理工具。追踪和管理你观看的电影和剧集进度。