Rewriting Git History: Removing Unwanted AI Contributors from Your Software Development Activity

In the rapidly evolving landscape of software development, integrating AI tools into our workflows has become commonplace. While these tools significantly boost efficiency, they can sometimes introduce unexpected quirks. A recent GitHub community discussion, initiated by user jacqpark, highlights one such scenario: accidentally adding an AI as a repository contributor.

Jacqpark's dilemma was straightforward: an AI contributor named "claude" was inadvertently added to an older commit in their prettyPanelMatch repository. This raised a crucial question for many developers: how do you remove an unwanted, non-human entry from your project's contributor list, especially when it impacts your recorded software development activity?

Developer cleaning up Git commit history to remove an AI contributor.
Developer cleaning up Git commit history to remove an AI contributor.

The Solution: Rewriting Git History

While GitHub's initial response was an automated feedback submission, community member jannoguer provided a comprehensive solution. The core issue is that GitHub links the AI account to the email address used, recognizing it as a contributor. To rectify this, developers must rewrite Git history to amend the author information for those specific commits.

Jannoguer outlined a "standard" approach using an interactive rebase, a powerful Git command for altering commit history:

  1. Initiate Interactive Rebase:
    git rebase -i --root --committer-date-is-author-date

    Mark pick to edit for each commit where the AI contributor was accidentally added.

  2. Amend the Author:
    git commit --amend --author="jacqpark " --no-edit

    At each paused commit, run this to change the author back to yourself (replace with your name and email).

  3. Continue and Force Push:
    git rebase --continue

    Repeat step 2 and this step for every marked commit. Once complete, update the remote repository with:

    git push --force-with-lease

    Use --force-with-lease with caution, as rewriting history can impact collaborators.

Pro-Tip for Faster Contributor Graph Updates

After rewriting history, GitHub's contributor graph might take weeks or months to update. Jannoguer shared a clever workaround:

  • Change the branch name (e.g., from main to main1).
  • Then, change it back (e.g., from main1 to main).

This simple trick often prompts GitHub to re-evaluate the branch's history and update the contributor graph faster, ensuring your productivity monitoring software and insights reflect the true team.

Visualizing Git history correction and contributor graph update.
Visualizing Git history correction and contributor graph update.

Key Takeaways for Developer Productivity

This discussion underscores the importance of understanding Git's history manipulation tools. While accidental AI contributions are a new challenge, maintaining a clean and accurate commit history remains vital for effective collaboration and precise tracking of software development activity. Correcting such errors ensures your project's contributor list truly reflects human effort and helps maintain data integrity for any productivity monitoring software you might use.

Track, Analyze and Optimize Your Software DeveEx!

Effortlessly implement gamification, pre-generated performance reviews and retrospective, work quality analytics, alerts on top of your code repository activity

 Install GitHub App to Start
devActivity Screenshot