Skip to main content
Claude Code has deep git integration. You can use slash commands for structured git operations or just describe what you want in natural language.

Committing changes

The /commit command analyzes your staged changes and generates a commit message.
1

Stage your changes

Use git as normal to stage files:
2

Run /commit

Inside the Claude Code REPL:
Claude analyzes the diff and proposes a commit message.
3

Confirm or edit

Review the proposed message, edit if needed, then confirm to create the commit.
You can also describe commits naturally:

Viewing diffs

The /diff command shows your current working tree or staged changes:
You can also ask Claude to explain a diff:

Branch management

Use /branch to create and switch branches:
Or naturally:

Reviewing PR comments

The /pr_comments command fetches open review comments from your current GitHub PR:
Claude displays each comment with context and can help you address them:

Worktree isolation

For large refactors, Claude Code supports git worktrees to isolate changes:
This uses EnterWorktreeTool to create an isolated git worktree. Exit with ExitWorktreeTool when done.
For complex multi-file changes, stage interactively with git add -p before running /commit so Claude generates a focused, accurate message.