Build This Now
Build This Now
What Is Claude Code?Claude Code InstallationClaude Code Native InstallerYour First Claude Code Project
speedy_devvkoen_salo
Blog/Handbook/Workflow/Git Integration

Git Integration

Claude Code drives git from your terminal. Say what you need in plain English and the commit, branch, or PR lands with your team's conventions baked in.

Stop configuring. Start building.

SaaS builder templates with AI orchestration.

Published Feb 23, 2026Handbook hubWorkflow index

Problem: You wrapped a batch of edits with Claude Code and now the diff is sitting there, unstaged, and you need the history to read cleanly.

Quick Win: Once Claude wraps the work, ask for a commit in plain English:

claude "commit these changes"

The diff gets read, a real commit message gets written, and git commit runs on your behalf. No fake config, no plugins, nothing to install.

Git commands run straight through your terminal when Claude Code is open. There's no "auto-commit" mode to toggle and nothing to wire up. You ask, it happens.

Here's what Claude handles:

  • Run any git command: add, commit, push, pull, branch, merge
  • Write commit messages: Based on the actual changes it made
  • Create branches: For features or experiments
  • Create PRs: Using the gh CLI if installed
  • Resolve conflicts: By reading both versions and merging intelligently

Because Claude can see the git history and follow the thread of your work, the commit messages describe what actually changed and why.

Set Conventions in CLAUDE.md

Skip fake config commands. Drop your team's commit rules into CLAUDE.md instead:

## Git Conventions
 
- Use conventional commits: feat:, fix:, docs:, refactor:
- Keep subject lines under 72 characters
- Always run tests before committing
- Create feature branches for new work

Ask for a commit from then on and Claude falls in line with whatever you wrote.

Real Git Workflows

Simple Commit After Changes

# Claude just finished implementing a feature
claude "commit these changes"
 
# Or be more specific
claude "commit with message: add user authentication flow"

Feature Branch Workflow

# Start new work on a branch
claude "create a feature branch called auth-improvements and switch to it"
 
# Make changes, then commit
claude "commit the auth changes with a descriptive message"
 
# When ready, create a PR
claude "push this branch and create a PR with a summary of changes"

Reviewing Before Committing

# See what changed first
claude "show me a summary of all uncommitted changes"
 
# Then commit selectively
claude "commit only the changes in src/auth/ with message: refactor auth module"

Commit Attribution

Commits and PRs from Claude carry attribution by default, so your team (and future you) can tell which work was AI-assisted. Whatever lands in the message is governed by the attribution key inside settings.json.

Default Attribution

Commits get two lines tacked on:

Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply>

Line one is plain text. Line two is a git trailer, a format that GitHub (and other hosts) parses to surface Claude as a co-author on the commit.

For pull requests, the attribution lands as a shorter blurb in the description:

Generated with Claude Code (https://claude.com/claude-code)

Customizing Attribution

Commit and PR attribution each have their own key under settings.json:

{
  "attribution": {
    "commit": "Generated with AI\n\nCo-Authored-By: AI Assistant <your-ai-alias>",
    "pr": "AI-assisted PR"
  }
}

Rewrite the body text, the Co-Authored-By name and email, or every piece at once. The \n\n is what separates the message from the trailer block, and the git trailers format requires it.

Disabling Attribution

Empty string on either key turns the line off:

{
  "attribution": {
    "commit": "",
    "pr": ""
  }
}

That hides attribution on commits, PRs, or both. Handy for teams that log AI usage somewhere else.

Migration from includeCoAuthoredBy

The older includeCoAuthoredBy boolean is on its way out. If you had "includeCoAuthoredBy": false, port it over to attribution:

// Old (deprecated)
{ "includeCoAuthoredBy": false }
 
// New (recommended)
{
  "attribution": {
    "commit": "",
    "pr": ""
  }
}

Finer control falls out of the new setting. Commit attribution can switch off while PR attribution stays put, or the reverse. Drop the block into whichever scope you want it to cover, whether that's user, project, or local.

When Things Go Wrong

Error: "nothing to commit". Fix: either Claude already ran the commit, or the files never made it into the index. Have Claude take a look:

claude "what's the current git status?"

Error: "permission denied" on push. Fix: the remote wants auth. Credentials aren't something Claude can hand over for you, though it can walk you through the diagnosis:

claude "help me debug this git push error"

Error: Merge conflicts. Fix: Claude can walk them out:

claude "there are merge conflicts in auth.js - resolve them keeping our new changes"

Next Steps

  • Feedback loops for faster iteration
  • Todo workflows to track work
  • Planning modes for complex changes
  • Settings reference for attribution and other options
  • Usage optimization to manage costs

Git inside Claude Code has no setup step. Tell Claude what git move you need, and the commands run. That's the whole trick.

Continue in Workflow

  • Claude Code Best Practices
    Five habits separate engineers who ship with Claude Code: PRDs, modular CLAUDE.md rules, custom slash commands, /clear resets, and a system-evolution mindset.
  • Claude Code Auto Mode
    A second Sonnet model reviews every Claude Code tool call before it fires. What auto mode blocks, what it allows, and the allow rules it drops in your settings.
  • Channels, Routines, Teleport, Dispatch
    The four Claude Code features Anthropic shipped in March and April 2026 that turn the CLI into an event-driven coordination layer across phone, web, and desktop.
  • Claude Code Channels
    Plug Claude Code into Telegram, Discord, or iMessage with plugin MCP servers. Setup walkthroughs and the async mobile workflows that make it worth wiring up.
  • Building a Next.js App With Claude Code
    How to use Claude Code to build a full Next.js 16 app — from project setup through App Router, Server Components, and deployment.
  • Claude Code Pricing: What You'll Actually Pay
    Claude Code is free to install. What you pay depends on your plan. A plain-English breakdown of every tier, real usage costs, and which plan fits your workflow.

More from Handbook

  • Agent Fundamentals
    Five ways to build specialist agents in Claude Code: Task sub-agents, .claude/agents YAML, custom slash commands, CLAUDE.md personas, and perspective prompts.
  • Agent Harness Engineering
    The harness is every layer around your AI agent except the model itself. Learn the five control levers, the constraint paradox, and why harness design determines agent performance more than the model does.
  • Agent Patterns
    Orchestrator, fan-out, validation chain, specialist routing, progressive refinement, and watchdog. Six orchestration shapes to wire Claude Code sub-agents with.
  • Agent Teams Best Practices
    Battle-tested patterns for Claude Code Agent Teams. Context-rich spawn prompts, right-sized tasks, file ownership, delegate mode, and v2.1.33-v2.1.45 fixes.

Stop configuring. Start building.

SaaS builder templates with AI orchestration.

On this page

Set Conventions in CLAUDE.md
Real Git Workflows
Simple Commit After Changes
Feature Branch Workflow
Reviewing Before Committing
Commit Attribution
Default Attribution
Customizing Attribution
Disabling Attribution
Migration from includeCoAuthoredBy
When Things Go Wrong
Next Steps

Stop configuring. Start building.

SaaS builder templates with AI orchestration.