# Git Workflow

> Purpose

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

---


## Purpose
Handle git operations following the project's specific conventions. Read the project's CLAUDE.md to understand branch naming, commit message format, and PR conventions before doing anything.

## Steps

### 1. Read Project Conventions
Before any git operation, read CLAUDE.md for:
- Commit message format (conventional commits? custom format?)
- Branch naming convention
- PR template (check `.github/pull_request_template.md` if it exists)

### 2. Check Current State
```bash
git status
git diff --stat HEAD
```

### 3. For Commits
- Group related changes into logical commits (not one giant commit)
- Write commit message following project conventions
- If conventional commits: `type(scope): description`
- Include breaking change footer if relevant
- Max subject line: 72 characters
- Body: what changed and WHY, not what (the diff shows what)

### 4. For Branches
- Read the issue/task first to understand scope
- Name: `type/short-description` (e.g., `feat/add-review-widget`, `fix/auth-cookie-bug`)
- Check it doesn't already exist: `git branch -a | grep name`

### 5. For PR Descriptions
Structure:
```markdown
## What
[One paragraph: what changed]

## Why  
[One paragraph: why this change was needed]

## How
[Brief technical explanation of the approach]

## Testing
[How to test this change]

## Checklist
- [ ] Tests pass
- [ ] No console.logs left
- [ ] Docs updated if needed
```

### 6. Safety Checks
- NEVER suggest `git push --force` on a shared branch
- NEVER commit to `main` or `master` directly
- Always check for secrets before committing: `git diff --cached | grep -i "api_key\|secret\|password\|token"`

## Output
Print the git commands to run (don't run them automatically unless the user said "just do it").
Explain what each command does if it's non-obvious.

