Altered Histories in Version Control System Repositories: Evidence from the Trenches

Solal Rapaport, Laurent Pautet, Samuel Tardieu, Stefano ZacchiroliarXiv 2025 · DOI · arXiv

Abstract

Distributed Version Control Systems (DVCS) like Git are designed to be append-only, yet they provide mechanisms to "rewrite" history. While these features are intended for local use, their application to public repositories has significant implications for security, auditability, and reproducibility. This paper presents the first massive-scale study of history alterations across 111 million public Git repositories. By leveraging the Software Heritage archive, we identify 12.5 billion altered histories. Our findings reveal that history rewriting is surprisingly common, particularly in popular projects and even on stable branches, challenging the assumption of repository immutability.

Introduction

In the software engineering community, Git commit hashes are often treated as permanent, unique identifiers. However, the reality of development often involves "cleaning up" history through commands like git commit --amend and git rebase. When these actions are performed on public branches, they effectively delete the previous state of the repository, creating a "blind spot" for security audits and breaking downstream dependencies. This study aims to quantify this phenomenon and understand its drivers.

Methodology and Dataset

To study history that is designed to disappear, the researchers utilized the Software Heritage (SWH) archive. SWH periodically crawls public repositories and preserves every commit it finds, allowing for a retrospective comparison between what was once present and what remains.

The study analyzed a filtered dataset of 111 million public Git repositories from the August 2024 SWH snapshot. The researchers developed a methodology to identify "altered commits"—those present in an older archival snapshot but missing from a newer one—and categorized them based on whether they modified metadata (META) or directory content (DIR).

Key Findings: The Popularity Paradox and Branch Instability

One of the most striking insights is the correlation between project popularity and history alteration. Contrary to the intuition that mature projects would have more stable histories, repositories with 100+ stars are ten times more likely to have altered histories (~3.3%) than those with 0-1 stars (0.3%). This "Popularity Paradox" suggests that as projects gain visibility, there is a greater perceived need to maintain a curated, "clean" history.

Percentage of repositories with altered history across star ranges.

Furthermore, the study challenges the notion that primary branches are immutable. While most alterations occur in pull requests (37.57%), a significant 11.39% of alterations occur on main or master branches. This instability on "stable" branches poses a direct risk to software supply chain security.

Distribution of history alterations across different branch types.

Results: Content vs. Metadata

The analysis identified that 76.8% of alterations involved actual changes to file or directory content (DIR), while 13.3% were metadata-only (META). The most frequently altered files were configuration and build artifacts (e.g., package.json, Makefile), indicating that automated dependency update bots are major drivers of history rewriting.

The study also uncovered instances of "retroactive licensing," where developers used history rewrites to change licenses in the past, and ineffective secret removal, where sensitive information remained in the SWH archive despite being "deleted" from the live repository's history.

Conclusion and Future Work

History alteration is not an edge case but a pervasive practice in public version control. This research highlights the need for tools like GITHISTORIAN to detect and audit these changes. For the research community, these findings serve as a warning: empirical studies that rely on Git history as an objective record must account for the fact that this history may have been sanitized or restructured. Future work will focus on distinguishing between benign maintenance and malicious supply chain attacks.

Summary updated

Abstract

Version Control Systems (VCS) like Git allow developers to locally rewrite recorded history, e.g., to reorder and suppress commits or specific data in them. These alterations have legitimate use cases, but become problematic when performed on public branches that have downstream users: they break push/pull workflows, challenge the integrity and reproducibility of repositories, and create opportunities for supply chain attackers to sneak into them nefarious changes. We conduct the first large-scale investigation of Git history alterations in public code repositories. We analyze 111 M (millions) repositories archived by Software Heritage, which preserves VCS histories even across alterations. We find history alterations in 1.22 M repositories, for a total of 8.7 M rewritten histories. We categorize changes by where they happen (which repositories, which branches) and what is changed in them (files or commit metadata). Conducting two targeted case studies we show that altered histories recurrently change licenses retroactively, or are used to remove ''secrets'' (e.g., private keys) committed by mistake. As these behaviors correspond to bad practices-in terms of project governance or security management, respectively-that software recipients might want to avoid, we introduce GitHistorian, an automated tool, that developers can use to spot and describe history alterations in public Git repositories.
BibTeX
@misc{rapaport2025altered,
  author = {Solal Rapaport and Laurent Pautet and Samuel Tardieu and Stefano Zacchiroli},
  title = {{Altered Histories in Version Control System Repositories: Evidence from the Trenches}},
  year = {2025},
  eprint = {2509.09294},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.09294},
}
Figure