git-filter-repo icon indicating copy to clipboard operation
git-filter-repo copied to clipboard

Overzealous reference rewriting

Open keks opened this issue 3 months ago • 0 comments

I tried using this to remove a directory that was recently added to the history, but rewrote years of commit history. I diffed the original and rewritten version of the oldest commit that changed, and it contained this:

$ diff -U 10 <(git -C original-repo show $original-commit-hash) <(git -C rewritten-repo show $rewritten-commit-hash)
 diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
 new file mode 100644
-index 000000000..1f0e20576
+index 00000000..1f0e2057
 --- /dev/null
 +++ b/.github/workflows/rust.yml

I don't think there is a real reason to rewrite the hashes, or is there?

Something similar can be seen in the diff of the logs:

$ diff -u <(git -C original-repo log) <(git -C rewritten-repo log) | tail

 commit 988881adc9fc3655077dc2d4d757d480b5ea0e11
-Merge: 279453517 421a271e0
+Merge: 27945351 421a271e
 Author: ...
 Date:   ...

But that didn't seem to affect the subsequent hashes.

keks avatar Sep 30 '25 08:09 keks