git-workflow
Git workflow patterns including branching strategies, commit conventions, merge vs rebase, conflict resolution, and collaborative development best practices for teams of all sizes. Use when choosing a branching strategy, writing commit conventions, deciding merge versus rebase, or resolving conflict
By affaan-m · 3,022 installs
npx skills add affaan-m/ecc --skill git-workflow
Source repository · Upstream listing
Git Workflow Patterns
Best practices for Git version control, branching strategies, and collaborative development.
When to Activate
Setting up Git workflow for a new project
Deciding on branching strategy (GitFlow, trunk based, GitHub flow)
Writing commit messages and PR descriptions
Resolving merge conflicts
Managing releases and version tags
Onboarding new team members to Git practices
Branching Strategies
GitHub Flow (Simple, Recommended for Most)
Best for continuous deployment and small to medium teams.
Rules:
main is always deployable
Create feature branches from main
Open Pull Request when ready for review
After approval and CI passes, merge to main
Deploy immediately after merge
Trunk Based Development (High Velocity Teams)
Best for teams with strong CI/CD and feature flags.
Rules:
Everyone commits to main or very short lived branches
Feature flags hide incomplete work
CI must pass before merge
Deploy multiple times per day
GitFlow (Complex, Release Cycle Driven)
Best for scheduled releases and enterprise projects.
Rules:
main contains production ready code only
develop is the integration branch
Feature branches from develop , merge back to develop
Release branches from develop , merge to main and develop
Hotfix branches from main , merge to both main and develop
When to Use Which
Strategy Team Size Release Cadence Best For
GitHub Flow Any Continuous SaaS, web apps, startups
Trunk Based 5+ experienced Multiple/day High velocity teams, feature flags
GitFlow 10+ Scheduled Enterprise, regulated industries
Commit Messages
Conventional Commits Format
Types
Type Use For Example
feat New feature feat(auth): add OAuth2 login
fix Bug fix fix(api): handle null response in user endpoint
docs Documentation docs(readme): update installation instructions
style Formatting, no code change style: fix indentation in login component
refactor Code refactoring refactor(db): extract connection pool to module
test Adding/updating tests test(auth): add unit tests for token validation
chore Maintenance tasks chore(deps): update dependencies
perf Performance improvement perf(query): add index to users table
ci CI/CD changes ci: add PostgreSQL service to test workflow
revert Revert previous commit revert: revert "feat(auth): add OAuth2 login"
Good vs Bad Examples
Commit Message Template
Create .gitmessage in repo root:
Enable with: git config commit.template .gitmessage
Merge vs Rebase
Merge (Preserves History)
Use when:
Merging feature branches into main
You want to preserve exact history
Multiple people worked on the branch
The branch has been pushed and others may have based work on it
Rebase (Linear History)
Use when:
Updating your local feature branch with latest main
You want a linear, clean history
The branch is local only (not pushed)
You're the only one working on the branch
Rebase Workflow
When NOT to Rebase
Pull Request Workflow
PR Title Format
PR Description Template
Code Review Checklist
For Reviewers:
[ ] Does the code solve the stated problem?
[ ] Are there any edge cases not handled?
[ ] Is the code readable and maintainable?
[ ] Are there sufficient tests?
[ ] Are there security concerns?
[ ] Is the commit history clean (squashed if needed)?
For Authors:
[ ] Self review completed before requesting review
[ ] CI passes (tests, lint, typecheck)
[ ] PR size is reasonable (<500 lines ideal)
[ ] Related to a single feature/fix
[ ] Description clearly explains the change
Conflict Resolution
Identify Conflicts
Resolve Conflicts
Conflict Prevention Strategies
Branch Management
Naming Conventions
Branch Cleanup
Stash Workflow
Release Management
Semantic Versioning
Creating Releases
Changelog Generation
Git Configuration
Essential Configs
Useful Aliases
Gitignore Patterns
Common Workflows
Starting a New Feature
Updating a PR with New Changes
Syncing Fork with Upstream
Undoing Mistakes
Git Hooks
Pre Commit Hook
Pre Push Hook
Anti Patterns
Quick Reference
Task Command
Create branch git checkout b feature/name
Switch branch git checkout branch name
Delete branch git branch d branch name
Merge branch git merge branch name
Rebase branch git rebase main
View history git log oneline graph
View changes git diff
Stage changes git add . or git add p
Commit git commit m "message"
Push git push origin branch name
Pull git pull origin branch name
Stash git stash push m "message"
Undo last commit git reset soft HEAD~1
Revert commit git revert HEAD