On Sun, Mar 15, 2020 at 4:16 PM Damien Robert <damien.olivier.robert@xxxxxxxxx> wrote: > > From James Ramsay, Thu 12 Mar 2020 at 14:57:24 (+1100) : > > 6. Elijah: replace refs helps, but not supported by hosts like GitHub etc > > a. Stolee: breaks commit graph because of generation numbers. > > b. Replace refs for blobs, then special packfile, there were edge cases. > > I am interested in more details on how to handle this using replace. This comment at the conference was in reference to how people rewrite history to remove the big blobs, but then run into issues because there are many places outside of git that reference old commit IDs (wiki pages, old emails, issues/tickets, etc.) that are now broken. replace refs can help in that situation, because replace refs can be used to not only replace existing objects with something else, they can be used to replace non-existing objects with something else, essentially setting up an alias for an object. git filter-repo uses this when it rewrites history to give you a way to access NEW commit hashes using OLD commit hashes, despite the old commit hashes not being stored in the repository. The old commit hashes are just replace refs that replace non-existing objects (at least within the newly rewritten repo) that happen to match old commit hashes and map to the new commit hashes. Unfortunately this isn't quite a perfect solution, there are still three known downsides: * replace refs cannot be abbreviated, unlike real object ids. Thus, if you have an abbreviated old commit hash, git won't recognize it in such a setup. * commit-graph apparently assumes that the existence of replace refs implies that commit objects in the repo have likely been replaced (even though that is not the case for this situation), and thus is disabled when such refs are present. * external GUI programs such as GitHub and Gerrit and likely others do not honor replace refs, instead showing you some form of "Not Found" error. As for using replace refs to attempt to alleviate problems without rewriting history, that's an even bigger can of worms and it doesn't solve clone/fetch/gc/fsck nor the many other places you highlighted in your email.