[GH-ISSUE #356] AI attribution lost in second commit when committing files in batches #128

Closed
opened 2026-03-02 04:12:01 +03:00 by kerem · 3 comments
Owner

Originally created by @harvest-L on GitHub (Jan 16, 2026).
Original GitHub issue: https://github.com/git-ai-project/git-ai/issues/356

Problem Description

When committing files in multiple batches (separate commits), files in the second commit lose their AI attribution and are marked as entirely human-authored.

Reproduction Steps

  1. Use AI (Claude Code or Cursor) to edit multiple files
  2. Commit the first batch of files
    • These files correctly show AI attribution
  3. Commit the remaining files in a second commit
    • These files lose AI attribution
    • All lines are marked as human-authored

Expected Behavior

  • All files edited by AI should show correct AI attribution, regardless of which commit they are in
  • Second (or later) commits should maintain AI attribution for files edited by AI

Actual Behavior

  • First commit: Files correctly show AI attribution
  • Second commit: Files lose AI attribution, all lines marked as human-authored
  • git-ai blame shows human authorship for all lines in the second commit

Environment

  • git-ai version: 1.0.31
  • OS: Windows
  • AI tools: Claude Code / Cursor
  • Git workflow: AI edits multiple files → Commit in batches

Example Scenario

# Session 1: AI edits 5 files
# User commits files 1-3 → AI attribution correct ✓
# User commits files 4-5 → AI attribution lost ✗ (marked as human)

Additional Context

  • All AI edits happen in the same AI session
  • Files are committed separately (not all at once)
  • The issue only affects subsequent commits after the first one
  • Files in the first commit maintain correct AI attribution

This makes it difficult to use git-ai with realistic workflows where developers commit files in multiple batches rather than all at once.

Originally created by @harvest-L on GitHub (Jan 16, 2026). Original GitHub issue: https://github.com/git-ai-project/git-ai/issues/356 ## Problem Description When committing files in multiple batches (separate commits), files in the second commit lose their AI attribution and are marked as entirely human-authored. ## Reproduction Steps 1. Use AI (Claude Code or Cursor) to edit multiple files 2. Commit the first batch of files - These files correctly show AI attribution 3. Commit the remaining files in a second commit - These files lose AI attribution - All lines are marked as human-authored ## Expected Behavior - All files edited by AI should show correct AI attribution, regardless of which commit they are in - Second (or later) commits should maintain AI attribution for files edited by AI ## Actual Behavior - First commit: Files correctly show AI attribution - Second commit: Files lose AI attribution, all lines marked as human-authored - `git-ai blame` shows human authorship for all lines in the second commit ## Environment - git-ai version: 1.0.31 - OS: Windows - AI tools: Claude Code / Cursor - Git workflow: AI edits multiple files → Commit in batches ## Example Scenario ``` # Session 1: AI edits 5 files # User commits files 1-3 → AI attribution correct ✓ # User commits files 4-5 → AI attribution lost ✗ (marked as human) ``` ## Additional Context - All AI edits happen in the same AI session - Files are committed separately (not all at once) - The issue only affects subsequent commits after the first one - Files in the first commit maintain correct AI attribution This makes it difficult to use git-ai with realistic workflows where developers commit files in multiple batches rather than all at once.
kerem closed this issue 2026-03-02 04:12:03 +03:00
Author
Owner

@svarlamov commented on GitHub (Jan 16, 2026):

Git AI does support partially-staged commits and there are test cases in the codebase covering this functionality. Could you please provide a shell script or a concrete example to reproduce it? Thanks!

<!-- gh-comment-id:3761555119 --> @svarlamov commented on GitHub (Jan 16, 2026): Git AI does support partially-staged commits and there are test cases in the codebase covering this functionality. Could you please provide a shell script or a concrete example to reproduce it? Thanks!
Author
Owner

@harvest-L commented on GitHub (Jan 17, 2026):

  1. Prepare Test Environment
    • Create two empty files in the working directory: a.txt and b.txt
    • Ensure the working directory is clean (no uncommitted changes)
  2. Modify Files Using Cursor
    - Use Cursor to add one line of content to both a.txt and b.txt
    - At this point, both files have uncommitted changes
  3. Manually Modify File
    - Manually edit a.txt and modify its content
  4. First Commit
    - Execute git add a.txt
    - Execute git commit -m "commit a"
    - Expected result: Commit succeeds, author information for a.txt is correct
  5. Second Commit
    - Immediately execute git add .
    - Execute git commit -m "commit b"
    - Issue: The modification to b.txt is incorrectly attributed as "manually modified" instead of Cursor modified
<!-- gh-comment-id:3762943061 --> @harvest-L commented on GitHub (Jan 17, 2026): 1. Prepare Test Environment - Create two empty files in the working directory: a.txt and b.txt - Ensure the working directory is clean (no uncommitted changes) 2. Modify Files Using Cursor - Use Cursor to add one line of content to both a.txt and b.txt - At this point, both files have uncommitted changes 3. Manually Modify File - Manually edit a.txt and modify its content 4. First Commit - Execute git add a.txt - Execute git commit -m "commit a" - Expected result: Commit succeeds, author information for a.txt is correct 5. Second Commit - Immediately execute git add . - Execute git commit -m "commit b" - Issue: The modification to b.txt is incorrectly attributed as "manually modified" instead of Cursor modified
Author
Owner

@palashkaria commented on GitHub (Feb 4, 2026):

@svarlamov looks like the tests didn't cover multi-file issue that this issue reports. I faced the same, and added some tests here: https://github.com/git-ai-project/git-ai/pull/451/changes/66177fc3771ce2171b14db48e9d0b2cf7f7f8ea9

the PR #451 also fixes the issue. Please take a look!

<!-- gh-comment-id:3845441398 --> @palashkaria commented on GitHub (Feb 4, 2026): @svarlamov looks like the tests didn't cover multi-file issue that this issue reports. I faced the same, and added some tests here: https://github.com/git-ai-project/git-ai/pull/451/changes/66177fc3771ce2171b14db48e9d0b2cf7f7f8ea9 the PR #451 also fixes the issue. Please take a look!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-ai#128
No description provided.