Git Workflow
Git commit conventions, branch naming, and workflow best practices for clean version history. Activate when committing, branching, rebasing, or reviewing git history.
Git Workflow Skill
Overview
This skill encodes git commit conventions (Conventional Commits), branch naming rules, and workflow best practices. Activate it when you need to commit changes, name a branch, clean up history, or review git practices in a project.
Instructions
Commit Message Format
Follow the Conventional Commits specification:
<type>(<scope>): <short summary>
[optional body]
[optional footer]
Types:
feat— new featurefix— bug fixrefactor— code change that neither fixes a bug nor adds a featureperf— performance improvementtest— adding or updating testsdocs— documentation onlychore— build process, tooling, dependenciesci— CI/CD changes
Rules:
- Summary line: max 72 characters, imperative mood ("add" not "added")
- No period at end of summary
- Body: wrap at 72 characters, explain why not what
- Reference issues in footer:
Fixes #123,Closes #456
Branch Naming
<type>/<short-description>
feat/user-profile-pagefix/login-redirect-looprefactor/extract-auth-middlewarechore/upgrade-tokio-1.40
Use kebab-case. Keep it short but descriptive. Match the commit type.
Workflow Rules
- Never commit directly to
main— always use a branch - Keep commits atomic — one logical change per commit
- Rebase before merging — keep history linear:
git rebase main - Squash WIP commits before opening a PR
- Tag releases with semantic versioning:
v1.2.3
Examples
Good commit message
feat(auth): add JWT refresh token rotation
Prevents token reuse after logout by invalidating the previous
refresh token on each use.
Closes #89
Bad commit message → fix it
# Bad
fixed stuff
update
WIP
# Good
fix(api): handle empty response body in error parser
The parser panicked when the server returned a 500 with no body.
Added a fallback to use the status text instead.
Common commands
# Start a feature
git checkout -b feat/my-feature
# Stage only relevant changes
git add -p
# Amend last commit (before push)
git commit --amend --no-edit
# Interactive rebase to clean up
git rebase -i HEAD~3
# Check what will be committed
git diff --staged
# Tag a release
git tag -a v1.2.3 -m "Release v1.2.3"
git push origin v1.2.3