2.4 KiB
		
	
	
	
	
	
			
		
		
	
	Claude Code Git Integration
This document explains how to use the custom git commands created for Claude Code to summarize file changes and commit them with proper attribution.
Installation
The custom git command has been installed in your system with the following components:
- A git-claudescript in~/bin/directory
- A git alias claudethat points to the script
- A git hook that automatically summarizes changes in commit messages
Usage
1. Summarize Changes
To get a summary of current changes in your repository:
git claude summarize
This command will show:
- Staged changes (files ready to be committed)
- Unstaged changes (modified files not yet staged)
- Untracked files (new files not yet added to git)
2. Commit with Claude Signature
To commit changes with the proper Claude Code signature:
git claude commit "Your commit message here"
This command will:
- Stage all changes if none are currently staged
- Create a commit with your message
- Automatically add the Claude Code signature:
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
3. Using Standard Git Commands
You can also use standard git commands which will now include Claude Code summaries:
# Standard git add and commit
git add .
git commit -m "Your message"
# The prepare-commit-msg hook will automatically add a summary
How It Works
- 
Git Hook: The prepare-commit-msghook in.git/hooks/automatically adds a summary of changes to your commit messages.
- 
Custom Command: The git-claudescript provides a convenient interface for common Claude Code workflows.
- 
Git Alias: The git claudealias allows you to usegit claudeinstead ofgit-claude.
Examples
# Get a summary of current changes
git claude summarize
# Commit changes with a custom message
git claude commit "Add new user authentication feature"
# Commit changes with default message
git claude commit
Troubleshooting
If you encounter any issues:
- Make sure the ~/bin/directory is in your PATH
- Verify the script is executable: chmod +x ~/bin/git-claude
- Check that the git alias is properly configured: git config --get-regexp alias.claude
Customization
You can customize the behavior by modifying the scripts in:
- ~/bin/git-claude- Main script
- .git/hooks/prepare-commit-msg- Commit message hook