When AI assistants make code changes on your behalf, proper attribution is essential. Modern AI coding agents like Claude Code and OpenCode automatically add themselves as co-authors when they create commits.
However, you should still add yourself as a co-author to indicate that you reviewed and approved the AI's work.
| Tool | Default Behavior | Notes |
| Claude Code | ✅ Auto (configurable) | Adds Co-Authored-By: Claude <model> <[email protected]> - see settings |
| OpenCode | ✅ Auto | Adds model as co-author |
| GitHub Copilot | ❌ Manual setup | See setup below |
| Cursor | ❌ Manual setup | See setup below |
✅ Figure: Good example - Co-authoring lets you see if AI helped
When working with AI agents on larger tasks, ask them to create commits in a logical order that "tells a story" of the implementation. This makes code reviews easier and helps future developers understand the evolution of a feature.
Prompt tip: When asking an AI agent to implement a feature with multiple components, include:
"Please commit changes in a logical order that tells a story - for example, data models first, then business logic, then UI components, and finally tests."
Example story-driven commit sequence:
feat: Add User database model and migrations - Foundation firstfeat: Implement user authentication service - Core logicfeat: Add login and registration API endpoints - Interface layerfeat: Create login form component - UI implementationtest: Add authentication unit and integration tests - VerificationThe standard Git co-author format:
git commit -m "feat: Add recipe search functionalityCo-authored-by: Your Name <[email protected]>"
To find your details, run: git config user.name and git config user.email
✅ DO add yourself when:
❌ DON'T add yourself for:
For tools that don't auto-attribute, add the following to your AI assistant configuration (e.g., .github/copilot-instructions.md, .cursorrules, or AGENTS.md):
## Git Commit Guidelines### Commit FrequentlyCommit changes incrementally as you complete logical units of work:- After adding a new feature or component- After fixing a bug- After refactoring code- Before making major changes (safety checkpoint)### Co-Author Attribution**ALWAYS add the user as a co-author on commits** to ensure proper attribution.**How to identify the user:**1. Check `git config user.name` and `git config user.email`2. If in GitHub Codespaces, use the logged-in GitHub user**Format:**```bashgit commit -m "feat: Brief description
### Alternative: Git HookCreate a `prepare-commit-msg` hook to automatically add yourself as co-author:```bash#!/bin/bash# .git/hooks/prepare-commit-msgCOMMIT_MSG_FILE=$1COMMIT_SOURCE=$2if [ -z "$COMMIT_SOURCE" ]; thenCOAUTHOR_NAME=$(git config user.name)COAUTHOR_EMAIL=$(git config user.email)if ! grep -q "Co-authored-by: $COAUTHOR_NAME" "$COMMIT_MSG_FILE"; thenecho "" >> "$COMMIT_MSG_FILE"echo "Co-authored-by: $COAUTHOR_NAME <$COAUTHOR_EMAIL>" >> "$COMMIT_MSG_FILE"fifi
Note: Git hooks are local and not committed to the repository. Share with your team via documentation.