| name | git-workflows |
| description | Git version control workflows, branching strategies, and conflict resolution. Use when managing branches, resolving merge conflicts, understanding git history, or following team git conventions. |
Git Workflows Guide
Expert guidance for Git version control workflows, branching strategies, and
conflict resolution.
Core Principles
- Atomic commits - One logical change per commit
- Clear history - Meaningful commit messages that explain why
- Branch hygiene - Keep branches focused and short-lived
- Safe operations - Understand destructive commands before using
- Collaboration-friendly - Follow team conventions consistently
Detailed Reference Material
- examples.md - Common workflows, including Feature Branch,
Trunk-Based, Conflict Resolution, and fixup/autosquash examples.
- reference.md - Branch naming conventions, conflict strategies,
command reference tables, and fixup/autosquash strategy.
Quick Summary
Branch Naming
Use prefixes like feat/, fix/, docs/, refactor/ to categorize your
branches.
Workflow Checklist
Before starting work:
During work:
Before PR:
Fixup + Autosquash
Use this when follow-up fixes belong to earlier commits and you want clean,
atomic history:
git commit --fixup=<target-commit-hash>
GIT_SEQUENCE_EDITOR=: git rebase -i --autosquash <oldest-target-hash>^
Then verify with:
git log --oneline -n 20
git status --short
Useful Git Commands
Inspection Commands
git log --oneline -20
git log --graph --all --oneline
git diff
git diff --cached
git diff main..feature
git blame <file>
git log -p -- <file>
Safety Guidelines
- Never force push to main/master
- Check if others are using the branch before force pushing
- Use
--force-with-lease instead of --force when possible
- Communicate with team first
See Also