Build This Now
Build This Now
What Is Claude Code?Claude Code InstallationClaude Code Native InstallerYour First Claude Code Project
Claude Code Best PracticesClaude Code on a VPSGit IntegrationClaude Code ReviewClaude Code WorktreesClaude Code Remote ControlClaude Code ChannelsClaude Code Scheduled TasksClaude Code PermissionsClaude Code Auto ModeFeedback LoopsTodo WorkflowsClaude Code TasksProject TemplatesClaude Code Pricing and Token Usage
Get Build This Now
speedy_devvkoen_salo
Blog/Handbook/Workflow/Git Integration

Git Integration

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

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.

More in this guide

  • Agent Fundamentals
    Five ways to build specialized agents in Claude Code, from sub-agents to .claude/agents/ definitions to perspective prompts.
  • Agent Patterns
    Orchestrator, fan-out, validation chain, specialist routing, progressive refinement, and watchdog. Six ways to wire sub-agents in Claude Code.
  • Agent Teams Best Practices
    Battle-tested patterns for Claude Code agent teams. Troubleshooting, limitations, plan mode quirks, and fixes shipped from v2.1.33 through v2.1.45.
  • Agent Teams Controls
    Stop your agent team lead from grabbing implementation work. Configure delegate mode, plan approval, hooks, and CLAUDE.md for teams.
  • Agent Teams Prompt Templates
    Ten tested Agent Teams prompts for Claude Code. Code review, debugging, feature builds, architecture calls, and campaign research. Paste and go.

Stop configuring. Start building.

SaaS builder templates with AI orchestration.

Get Build This Now

Claude Code on a VPS

Run Claude Code on a VPS with SSH, Docker, and headless mode. Real commands, monitoring patterns, and security hardening for a production box.

Claude Code Review

Parallel Claude agents hunt bugs on every PR, cross-check each other, and post one high-signal comment. Here is what it catches, what it costs, and how to enable it.

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.

Get Build This Now