When AI assistants make code changes on your behalf, proper attribution is essential. Adding yourself as a co-author when AI implements changes ensures transparency about who verified the work and maintains accurate contribution history.
This practice is especially important in team environments where AI assists with implementing features, fixing bugs, or making changes.
When AI makes changes without proper attribution, we don't know who checked the work of the AI:
Git History:
feat: Add authentication moduleAuthor: GitHub Copilot <[email protected]>
❌ Figure: Bad Example - No indication of who checked the AI's work
When you don't commit frequently during a Copilot session:
Single massive commit at the end:
feat: Complete authentication system- Add login page- Add registration page- Add password reset- Add email verification- Add OAuth providers- Add user profile page- Update database schema- Add API endpoints- Add tests- Update documentation- Fix styling issues- Refactor validation logic
Issues:
❌ Figure: Bad Example - One giant commit makes it hard to understand the work progression and loses the relationship to task docs
Git supports multiple authors via the Co-authored-by trailer in commit messages. Combined with frequent, small commits, this creates a clear and reviewable history.
Proper Attribution:
Small, Vertical Commits:
Connection to Task Documentation:
Better approach - Multiple focused commits:
feat: Add login page with form validationCo-authored-by: Gordon Beeming <[email protected]>---feat: Add user registration with email verificationCo-authored-by: Gordon Beeming <[email protected]>---feat: Add OAuth provider integration (Google, GitHub)Co-authored-by: Gordon Beeming <[email protected]>---docs: Document authentication implementationUpdates task doc with OAuth setup detailsCo-authored-by: Gordon Beeming <[email protected]>
Result:
✅ Figure: Good Example - Small, focused commits with proper attribution and documentation
Check these sources to determine your details for co-author attribution:
git config user.name and git config user.emailThe standard Git co-author format:
git commit -m "feat: Add recipe search functionalityCo-authored-by: Gordon Beeming <[email protected]>"
Git History Shows:
Result: Both the AI implementer and human verifier are visible in GitHub's UI and git log
✅ Figure: Good Example - You get proper credit for verifying and approving the AI's work
For collaborative work where multiple people reviewed the AI's work:
git commit -m "feat: Implement user authentication systemCo-authored-by: Gordon Beeming <[email protected]>Co-authored-by: Daniel Mackay <[email protected]>"
✅ Good Example - All reviewers are properly credited
Add the following section to your AI assistant configuration (e.g., .github/copilot-instructions.md, .cursorrules, .ai/instructions.md, or your preferred location):
## Git Commit Guidelines### Commit FrequentlyCommit changes incrementally as you complete logical units of work.****Why** commit frequently:**- Creates small, focused commits that are easy to review and understand- Enables vertical slicing - each commit represents a single logical change- Avoids one giant commit at the end of a session with dozens of unrelated changes- Makes it easier to track progress and document work in task docs created- Allows reverting specific changes without losing other work- Provides clear checkpoints during development****When** to commit:**- After adding a new feature or component- After fixing a bug- After updating documentation (including task documentation)- After refactoring code- Before making major changes (safety checkpoint)- After successful test runs**Exception:** Do not commit when working on the `gitbutler/workspace` branch - GitButler manages commits on this branch.### Co-Author Attribution for AI-Assisted Work**ALWAYS add yourself as a co-author on commits** when AI implements code to ensure proper attribution.**How to identify yourself:**1. **Git config**: Check `git config user.name` and `git config user.email`2. **GitHub user**: If running in GitHub Codespaces, use the logged-in GitHub user3. **Environment**: Check environment variables for user information**Co-Author Format:**```bashgit commit -m "Type: Brief description
Example:
git commit -m "feat: Add recipe search functionalityCo-authored-by: Gordon Beeming <[email protected]>"
Create a prepare-commit-msg hook to automatically add yourself as co-author:
#!/bin/bash# .git/hooks/prepare-commit-msgCOMMIT_MSG_FILE=$1COMMIT_SOURCE=$2# Only add co-author for regular commits (not merges, rebases, etc.)if [ -z "$COMMIT_SOURCE" ]; thenCOAUTHOR_NAME=$(git config user.name)COAUTHOR_EMAIL=$(git config user.email)# Add co-author if not already presentif ! 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 this with your team via documentation.
GitHub Commit View:
feat: Add authentication moduleAuthor: GitHub CopilotCo-authored-by: Gordon Beeming <[email protected]>
✅ Figure: Good Example - GitHub recognizes and displays all contributors
Proper commit attribution is essential when AI assists with code changes. By consistently adding yourself as co-author to commits, you: