Hacker News new | ask | show | jobs
by oasisaimlessly 59 days ago
Tools like git-filter-repo[1] support rewriting commit hashes in commit messages. git-filter-repo actually does it by default; see `--preserve-commit-hashes` in the manual[2].

[1]: https://github.com/newren/git-filter-repo

[2]: https://htmlpreview.github.io/?https://github.com/newren/git...

2 comments

Sure, but that's not going to rewrite Slack messages, emails, GitHub links, docs
Came to say something exactly like this... The old sha1 handle needs to be still available in the same way an HTTP 301 redirect would work.
I run into broken documentation links all the time at work. A few more isn't going to break us.
... do not migrate old repos? I'm not sure why people would do that. Or, if they do, why would they replace the current repo name instead of creating a different one and keeping the old one closed to make the references work.

I don't think this is going to be a problem at all.

Hmm. If this is a security issue that matters, would you not be expected to migrate?

Not talking about archived code, but active projects that pre-date git 3.0

His point is keep an archived sha1 version of the repo and an active sha256 version.

That way an old commit with a message having a sha1 can reference the archived version, and new commits reference the active version.

Some companies survive longer than five years. So old repos are also active ones.
If we don't need to migrate repos to sha256 them why do we need to change git to use sha256?
You keep the old repo for archival purposes and work with the new one.
I need git-filter-repo to rewrite entire documentation and also resurrect and rehire earlier employees to repeat their GPG signatures.