# Git Workflow

> git-workflow

- Skill: `npc-worldwide/git-workflow` (Agent Skill)
- Install (CLI): `npx skillmds@latest add npc-worldwide/git-workflow`
- Raw SKILL.md: https://api.skillmd.com/api/skills/npc-worldwide/git-workflow/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Productivity
- Author: npc-worldwide (https://skillmd.com/u/npc-worldwide)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/npc-worldwide/git-workflow

---


# git-workflow

Git workflow best practices. Use when asked about git branching, commits, or merge strategy. [Sections: branching, commits, merging, hotfix]

## Branching

Use feature branches off main/develop:
  git checkout -b feature/my-feature develop
Name branches descriptively:
  feature/ — new functionality
  fix/ — bug fixes
  chore/ — maintenance, deps, config
Keep branches short-lived. Rebase onto target before merging.


## Commits

Write clear commit messages:
  Line 1: imperative summary under 72 chars
  Line 3+: explain WHY, not what (the diff shows what)
One logical change per commit. Don't mix refactors with features.
Use conventional commits if the project uses them:
  feat: add user search
  fix: handle null avatar URL
  chore: bump eslint to v9


## Merging

Prefer squash merges for feature branches (clean history).
Use merge commits for long-lived branches (preserves context).
Always pull/rebase before merging to avoid unnecessary merge commits.
Delete branches after merging.
Run CI before merging — never merge a red build.


## Hotfix

For urgent production fixes:
  1. Branch off main: git checkout -b hotfix/fix-name main
  2. Make the minimal fix
  3. Test thoroughly
  4. Merge to main AND develop/release
  5. Tag the release
Keep hotfix scope minimal — fix only the immediate issue.

