Skip to content

Git Integration

Claude Code integrates seamlessly with Git for version control.

Common Git Operations

Check Status

> What files have I changed?
> Show uncommitted changes
> What's the current branch?

View Changes

> Show the diff for the last commit
> What changed in auth.ts?

Commit

> Commit my changes with a descriptive message
> Commit only the changes to src/

Branch Management

> Create a new branch for this feature
> Switch to the main branch
> List all branches

Merge and Rebase

> Merge the feature branch into main
> Rebase my branch on main
> Help me resolve merge conflicts

Using claude commit

Quick commit command:

claude commit

Claude will:

  1. Analyze your changes
  2. Generate a descriptive commit message
  3. Ask for approval
  4. Create the commit

Pull Request Workflow

> Create a pull request for my changes
> Summarize changes for a PR description
> Review the changes before PR

Conflict Resolution

> Help me resolve the merge conflicts
> Show me the conflicting files
> Explain what each side of the conflict does

Undo Operations

> Undo the last commit
> Discard changes to this file
> Reset to the previous state

Best Practices

  1. Commit frequently - Small, focused commits
  2. Write descriptive messages - Explain what and why
  3. Review before committing - Use git diff
  4. Use branches - Isolate feature work
  5. Keep main clean - Merge only tested code