Intermediate6 min read
Git Workflow with Claude Code
Let Claude manage commits, branches, and PRs while you focus on outcomes.
Claude Code as Your Git Partner
Claude Code has full git capabilities: status, diff, commit, branch, push, PR creation. It can handle the entire commit workflow while you focus on the feature.
Conventional Commits
Always use conventional commit format:
feat: add user avatar upload to profile page
fix: resolve race condition in session refresh
refactor: extract auth logic into dedicated hook
chore: upgrade Next.js 15 → 16
Claude will suggest commit messages in this format. Review them before accepting — commit messages are documentation.
Branch Naming Convention
For tracked work, use the project ticket format:
cc-113-learning-center
feat/user-avatars
fix/session-race-condition
The Safe Git Workflow
Ask Claude to:
- Run
git statusto review all changes - Run
git diffto inspect diffs before staging - Stage specific files (never
git add .blindly) - Commit with a descriptive message
- Push and create a PR if ready
What Claude Should Never Do
git push --forceon main/master (never)git reset --hardwithout explicit approvalgit commit --no-verify(bypasses hooks)- Commit .env or secrets files
Configure these as PreToolUse hooks to enforce at the system level, not just as instructions.
PR Workflow
When creating PRs, Claude should:
- Review the full commit history (not just the latest commit)
- Run
git diff main...HEADto see all changes - Write a comprehensive PR summary with test plan
- Check for PR templates in
.github/
The PR title and body are the permanent record of your work — invest in them.
Loading…
Claude Code
01Getting Started with Claude Code
02Writing Your First Effective Prompt
03File Editing and Navigation
04Using Agents in Claude Code
05Skills and the CCC Ecosystem
06Hooks: Automating the Development Loop
07Git Workflow with Claude Code
08Testing with Claude Code
09Plan Mode for Complex Work
10Advanced Patterns: ACPX, Loops, and Orchestration