[GH-ISSUE #342] When switching branches, each line of code is marked as being overwritten #120

Closed
opened 2026-03-02 04:11:57 +03:00 by kerem · 1 comment
Owner

Originally created by @wangkaizhuang on GitHub (Jan 12, 2026).
Original GitHub issue: https://github.com/git-ai-project/git-ai/issues/342

Originally assigned to: @acunniffe on GitHub.

If you switch branches before submitting, and then submit the code, you will find that the AI contribution is 0. Is this because switching branches caused an overwrite? Also, formatting can overwrite records. What are the solutions to these issues

Originally created by @wangkaizhuang on GitHub (Jan 12, 2026). Original GitHub issue: https://github.com/git-ai-project/git-ai/issues/342 Originally assigned to: @acunniffe on GitHub. If you switch branches before submitting, and then submit the code, you will find that the AI contribution is 0. Is this because switching branches caused an overwrite? Also, formatting can overwrite records. What are the solutions to these issues
kerem 2026-03-02 04:11:57 +03:00
Author
Owner

@acunniffe commented on GitHub (Jan 12, 2026):

Hey @wangkaizhuang - we're working on this for the next release. If you create a branch AI contributions in the working copy are attributed correctly, but when you checkout a HEAD with a different base sha they're lost. The sha changing is what causes the wip attributions to be lost.

Will look similar to the work we did to fix this in pull --rebase github.com/acunniffe/git-ai@115b82bd4e/src/commands/hooks/fetch_hooks.rs (L57)

Thanks for reporting

<!-- gh-comment-id:3738302332 --> @acunniffe commented on GitHub (Jan 12, 2026): Hey @wangkaizhuang - we're working on this for the next release. If you create a branch AI contributions in the working copy are attributed correctly, but when you checkout a HEAD with a different base sha they're lost. The sha changing is what causes the wip attributions to be lost. Will look similar to the work we did to fix this in `pull --rebase` https://github.com/acunniffe/git-ai/blob/115b82bd4e7624c1346ae43d1ee029782e8a3342/src/commands/hooks/fetch_hooks.rs#L57 Thanks for reporting
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#120
No description provided.