Working with git
Commits, PRs, and code reviews with Claude
Claude Code + git = fewer painful commits
With Claude Code, you can bring git into the workflow properly — descriptive commits, clean history, useful PR descriptions, and code review before you push.
Generating commit messages
"Look at the changes since the last commit (git diff HEAD) and write a commit message following conventional commits format:
type(scope): short description
Then a body paragraph explaining WHAT changed and WHY, not HOW.
Then commit it."
Creating PR descriptions
"Look at the diff between main and this branch. Write a PR description with:
- What this PR does (2-3 sentences)
- Why it's needed (the problem it solves)
- How to test it (step-by-step testing instructions)
- Any edge cases or risks to be aware of"
Pre-commit review
"Before I commit this, review the staged changes (git diff --staged). Check for:
- Debugging code left in (console.log, TODO comments)
- Secrets or credentials accidentally included
- Changes that seem unintended
- Missing tests for new functions
Flag anything I should address before committing."
Understanding someone else’s commits
"Explain what this commit does in plain English:
[paste git log or diff output]
Why was this change made? What problem was it solving?"
Good habit to build: Before every commit, ask Claude to do a pre-commit review. You’ll catch debug logs, incomplete changes, and potential issues before they hit your main branch.
Quizzes