All articles Day 6 · Working with it

Let it commit.
You review.

By Kowshik Kesavarapu 5 min quick start + 11 min full guide Oct 16, 2026

01Git is your safety net

Claude Code edits many files fast. That is the point, and also the risk. Git is what turns "it changed things" into "I can see exactly what changed and undo it". Used well, Claude does the tedious parts (staging, commit messages, PR descriptions, a first review) and you keep the decisions.

You do not need a special setup. Claude runs the same git commands you do, so it works in any repository. For pull requests it uses the GitHub CLI (gh), which we set up in section 05.

02Before you start: a clean tree

Run git status first. If the tree is clean, every change in the session is Claude's, and git diff shows exactly that. If you had unfinished work, commit it or stash it (git stash) before you begin.

>_Start a task on a branch
—☐✕
git status                    nothing to commit, working tree clean
git switch -c fix/login-redirect   work on a branch, never main
claude

Why not rely on /rewind? It restores files Claude edited with its own edit tools, and it is a great quick undo. But it does not track changes made by shell commands (rm, mv, cp), or edits from outside the session. Anthropic's own docs say checkpoints are for session-level recovery and are not a replacement for version control. Git is the permanent record.

03Review what changed

Never commit what you have not read. Three ways to look, all useful:

01/diff

In the terminal session, /diff shows the changes in your working tree, including everything Claude has edited so far.

02git diff

The plain command. git diff for unstaged changes, git diff --staged for what is about to be committed.

03VS Code diff

In the extension, a proposed edit opens in VS Code's side-by-side diff. Accept or reject each change before it lands.

04Source Control

VS Code's Source Control panel (Ctrl+Shift+G) lists every changed file next to the Claude panel. Click one to see its diff.

In VS Code, the extension's "Accept this change" and "Reject this change" buttons let you review one hunk at a time. If you edit the proposed text in the diff before accepting, Claude is told, so it does not assume the file matches its own version.

04Let it write the commit

Ask in plain words: commit my changes with a descriptive message. Claude looks at the diff and the recent history, then writes a message that fits. In Manual mode it asks before running the commit, so you see the message first.

>_Commit prompts that work
—☐✕
> commit my changes with a descriptive message
> split this into two commits: the bug fix, then the rename
> commit only the files in src/auth, leave the rest
> amend the last commit message to mention the redirect
Small commitsOne logical change each. Ask for the split: it is easier to review and to revert.
House stylePut your commit format in your CLAUDE file ("imperative subject under 72 characters, explain why in the body") and it follows it.
Commit trailerClaude adds a Co-Authored-By line to commits it makes. Change or hide it with the attribution setting in settings.json.
Commit oftenA commit before each new ask is a restore point you can git revert to.

In VS Code, the prompts are identical in the Claude panel. You can also commit with VS Code's own Source Control box and ask Claude for the message: "write a commit message for the staged changes".

05Open a pull request

Pull requests go through the GitHub CLI. Install it once and sign in:

>_One-time GitHub CLI setup
—☐✕
# Windows
winget install --id GitHub.cli
# macOS
brew install gh
# Linux (Debian/Ubuntu)
sudo apt install gh

gh auth login      follow the prompts, then check:
gh auth status

Then just ask: create a pr for my changes. Claude writes a title and a description from the actual diff, pushes the branch and opens the PR. Guide it when you want a particular shape:

>_PR prompts
—☐✕
> summarize the changes I've made to the auth module
> create a pr
> add the risks and how to test it to the PR description

Claude Code links the session to the PR it creates. Come back later with claude --from-pr 1234 (your own number) to reopen that session with its context. The same works in VS Code: the panel's session history lets you resume it.

Remember: a PR you open is yours. Read the description and the diff before you ask anyone to review. "Claude wrote it" is not a defence in code review.

06Ask for a review first

Before a human sees your code, have Claude look at it. Run /code-review (its alias is /review) on your current changes, or pass a PR number or branch:

>_Reviews
—☐✕
/code-review             review the current diff for bugs
/code-review high        go deeper (low, medium, high, xhigh, max)
/review 1234             review a pull request by number
/security-review         check this branch for security issues

/security-review compares your branch with the default branch on origin and looks for things like injection, auth mistakes and data exposure. Treat every finding as a lead to check, not an order. Claude can be wrong, and a reviewer who has not read the code cannot tell which findings matter. Reading someone else's PR works too: review PR 456 and list anything risky.

07Two jobs at once: worktrees

Two Claude sessions in the same folder edit the same files and trip over each other. A git worktree gives each task its own checkout and branch:

>_Parallel sessions
—☐✕
# terminal 1
claude --worktree feature-auth
# terminal 2
claude --worktree bugfix-123

The repository needs at least one commit first. In VS Code you can open several conversations in separate tabs, but give each its own worktree so they do not edit the same files.

08Guardrails for git

You set up permissions on Day 5. Here is the git version, in .claude/settings.json:

>_.claude/settings.json
—☐✕
{
  "permissions": {
    "allow": [ "Bash(git status *)", "Bash(git diff *)", "Bash(git log *)" ],
    "deny":  [ "Bash(git push --force *)", "Bash(git reset --hard *)" ]
  }
}
AllowRead-only git: status, diff, log. No risk, no more prompts.
Askcommit and push, so you see what leaves your machine.
DenyForce-push and reset --hard, the two commands that destroy work.
Never mainWork on a branch. Protect main on GitHub so a PR is the only way in.

09Try this today

BranchRun git switch -c with a new branch name, then start Claude.
ReviewAfter a change, run /diff (or open Source Control in VS Code) and read it.
CommitAsk for a commit message and read it before you accept.
Review itRun /code-review before you open the PR, then create a pr.

Next up: MCP. How to connect Claude Code to the tools and data you already use, from GitHub and your database to your browser.

Follow along

A new article lands every day. I post the short version on LinkedIn.