Claude Code
authorKRIATIZ
04 · In practice / lesson 1 of 2

Git and pull requests with the agent

20 minIntermediate5 steps

Git is your safety net when working with an agent: every change is visible in the diff and can be reverted. Here is a flow from branch to pull request where the agent does the routine and you make the decisions.

data and requestsproblem
Lesson stepsstep 1 of 5
  1. Branch
  2. Plan
  3. Diff
  4. Review
  5. PR
step 1 / 5how it works

A separate branch

Every task in its own branch. main stays working, any change can be reverted.

Key point

git is your safety net with an agent.

← → steps · space pause · R restart · ⌘K search
You will learn 6
Lesson notes

Feature workflow

  1. Branch. "Create feature/orders-date-filter from main".
  2. Plan in plan mode, your edits to the plan.
  3. Implementation in small steps with tests.
  4. Verification: tests, linter, your review of git diff.
  5. Review by a subagent or a separate session.
  6. Commit with a clear message.
  7. Pull request with a description via gh pr create.

Commits

  • Ask for atomic commits: one logical change per commit.
  • Describe the message format in CLAUDE.md, for example Conventional Commits.
  • Check that no extra files made it into the commit: logs, .env, generated code.

Pull requests

With gh installed, the agent creates a PR with a description: what changed, why, how to test. Ask it to add a checklist and a link to the issue. Human review stays mandatory: the agent writes code fast, but merging is your responsibility.

Reviewing changes

Review git diff main...HEAD as a strict reviewer:
bugs, unhandled errors, missing tests, leaked secrets.
Return a list with file and line, don't change code.

Do it in a new session or with a subagent: a fresh context catches what the authoring session missed.

Parallel work

To let the agent work on two tasks at once without mixing files, use git worktree: a separate working copy per branch, each with its own Claude Code session.

git worktree add ../my-app-filters feature/filters
cd ../my-app-filters && claude

Common mistakes

  • Working directly in main without a branch.
  • One giant commit for the whole feature.
  • A PR without a human looking at the diff.
  • Pushing without confirmation. Keep git push in the ask list.

Today's task

Take one feature through the full flow: branch, plan, implementation, subagent review, commits, PR. Time it and compare with your usual process.

Want to set up a development process with AI agents?

I will set up the process for your team: branches, review, hooks, CI and Claude Code rules.

Let’s talk
Vladyslav Koshelyev
Vladyslav Koshelyev

Developer at KRIATIZ. I build chatbots, websites and automation for businesses. Author of the course.

About the author · Telegram