Branching and feature development
Claude understands the branch model. Tell it which branch you want to work on — or ask it to create one — and it will set up and start building in a single instruction.
> Create a new branch called feature/user-profile-page and start
implementing the user profile feature.
> We're working on the auth-refactor branch. Add rate limiting to
the login endpoint.
Crafting commit messages
A good message explains why, not just what. Claude reads the diff and writes messages that follow your convention — and it can split a messy working tree into clean, atomic commits.
> Commit all staged changes with a commit message following
conventional commits (feat/fix/chore/docs).
> Write a commit message that explains WHY we made these changes,
not just what changed.
> Create an atomic commit for each logical change in this diff.
Pull request creation
Claude can open the PR for you, writing a description aimed at a reviewer who has never seen the feature — summary, testing notes, deployment considerations, even before/after screenshots for UI changes.
> Create a PR for these changes. Include a summary of changes,
testing notes, and deployment considerations.
> Write a PR description that would help a reviewer who hasn't
seen this feature before.
> Add screenshots to the PR description showing before/after for
the UI changes.
Merge conflict resolution
Conflicts are where Claude shines — it can explain what diverged in both branches before touching anything, then resolve with the precise blend of "ours" and "theirs" you ask for.
> We have merge conflicts in src/auth/middleware.ts. Resolve them —
prefer our approach for the session handling but accept their
changes to the error types.
> Explain the merge conflicts before resolving them. I want to
understand what changed in both branches.
Git archaeology
Your history is a searchable knowledge base. Ask when something changed and why, hunt down the commit that introduced a bug, or pipe raw git log output into Claude for a summary.
> When was the checkout flow last significantly changed and why?
> Find the commit that introduced the memory leak in the worker
process.
You can also feed git output to Claude non-interactively with -p:
git log --oneline | claude -p "summarize the last week of development activity"
Practice project
Try it: Take a real feature from idea to merged PR entirely through Claude Code prompts — branch, build, commit, and open the PR. Keep a log of the prompts you used so you can grow a personal prompt library you reuse on every feature.
Related tutorials
- Making Safe Code Changes — plan, review diffs, and checkpoint before you commit.
- Test-Driven Workflows — pair tests with your commits so every PR ships green.
- Browse the full Claude Code tutorial series.
Git Workflows FAQ
Can Claude Code create git branches for me?
Yes. Tell Claude which branch to work on or ask it to create one, and it will set up the branch and start implementing the feature in a single instruction.
How does Claude Code write commit messages?
Claude reads the diff and writes messages that follow your convention — for example conventional commits like feat, fix, chore, and docs — explaining why a change was made, not just what changed.
Can Claude Code open pull requests?
Yes. Claude can open the PR and write a reviewer-focused description with a summary, testing notes, deployment considerations, and even before/after screenshots for UI changes.
How does Claude Code resolve merge conflicts?
Claude can explain what diverged in both branches before touching anything, then resolve the conflict with the exact blend of ours and theirs you ask for.
Can Claude Code search git history?
Yes. You can ask when and why something changed or hunt down the commit that introduced a bug, and you can pipe git log output into claude -p for a plain-language summary.
Quick summary
- Claude drives the full workflow: branch → edit → commit → PR
- It writes conventional, why-focused messages and splits work into atomic commits
- Conflicts get explained before resolution, with precise ours/theirs control
- Treat git history as searchable — pipe
git logintoclaude -pfor summaries