Live data from Hacker News

Show HN: Git-knife – Edit commit messages, authors, and dates like a spreadsheet

github.com

21–30 of 109 posts

Re: Show HN: Git-knife – Edit commit messages, authors, and dates like a spreadsheet

#21
post #18

This is cool, but has anyone ever needed to rewrite commit authors or dates?

Yes, for instance it could be useful if someone’s been accidentally committing with a bogus email address. Or if you’re cleaning up some sort of mess and would like to recreate an accurate history. Obviously as with any “force push” situation, the usual caveats apply if this is on a branch others have checked out, but if the mess is big enough, it is sometimes worth it to send everyone a script to reset or just to ha…

If someone's been committing with a bogus email address and they're still working on the project, shouldn't they clean up their own commits?

Re: Show HN: Git-knife – Edit commit messages, authors, and dates like a spreadsheet

#23
post #18

Earlier quoted context omitted.

Yes, for instance it could be useful if someone’s been accidentally committing with a bogus email address. Or if you’re cleaning up some sort of mess and would like to recreate an accurate history. Obviously as with any “force push” situation, the usual caveats apply if this is on a branch others have checked out, but if the mess is big enough, it is sometimes worth it to send everyone a script to reset or just to ha…

If someone's been committing with a bogus email address and they're still working on the project, shouldn't they clean up their own commits?

Yeah, using this tool for example?

Re: Show HN: Git-knife – Edit commit messages, authors, and dates like a spreadsheet

#25

This is cool, but has anyone ever needed to rewrite commit authors or dates?

I've needed to do this for a bunch of reasons.

1. Sometimes I do a scraping project where I want the commit dates to match when the data actually changed, reconstructed from sources like the Internet Archive or the dates on https://platform.claude.com/docs/en/release-notes/system-pro... - for example here: https://github.com/simonw/research/commits/main/extract-syst... - or this project that attempted to reconstruct the history of Tim Berners-Lee's original browser: https://github.com/simonw/1991-WWW-NeXT-Implementation/commi...

2. Sometimes I split a Git repo into two, and I want to preserve the commit history (authors and dates) on the files that end up in the new repo - effectively replay the history of just one folder from the original to help create the new one.

3. I occasionally mess up cleaning up and merging a PR from an open source contributor such that the work is incorrectly credited to me. I'll fix the commit so that it credits the right person.

Re: Show HN: Git-knife – Edit commit messages, authors, and dates like a spreadsheet

#26
“It never reimplements git — it shells out to the system git CLI and rebuilds commits with git commit-tree, reusing each commit's original tree so file contents are provably never changed.”

Glad the LLM noted this - I was worried this would reimplement git

Re: Show HN: Git-knife – Edit commit messages, authors, and dates like a spreadsheet

#27
post #25

This is cool, but has anyone ever needed to rewrite commit authors or dates?

I've needed to do this for a bunch of reasons. 1. Sometimes I do a scraping project where I want the commit dates to match when the data actually changed, reconstructed from sources like the Internet Archive or the dates on https://platform.claude.com/docs/en/release-notes/system-pro... - for example here: https://github.com/simonw/research/commits/main/extract-syst... - or this project that attempted to reconstruct…

git-filter-repo is amazing for the second case. I've used it to split repos and rename folders multiple times.

Re: Show HN: Git-knife – Edit commit messages, authors, and dates like a spreadsheet

#29
post #27
post #25

Earlier quoted context omitted.

I've needed to do this for a bunch of reasons. 1. Sometimes I do a scraping project where I want the commit dates to match when the data actually changed, reconstructed from sources like the Internet Archive or the dates on https://platform.claude.com/docs/en/release-notes/system-pro... - for example here: https://github.com/simonw/research/commits/main/extract-syst... - or this project that attempted to reconstruct…

git-filter-repo is amazing for the second case. I've used it to split repos and rename folders multiple times.

Yeah, I wrote a TIL about that a few years ago: https://til.simonwillison.net/git/rewrite-repo-specific-file...

Re: Show HN: Git-knife – Edit commit messages, authors, and dates like a spreadsheet

#30

“It never reimplements git — it shells out to the system git CLI and rebuilds commits with git commit-tree, reusing each commit's original tree so file contents are provably never changed.” Glad the LLM noted this - I was worried this would reimplement git

Ha ha fair. But yeah shelling out to git and reusing the original tree object was deliberate means file contents can't change even if I screw up elsewhere.
Post reply on HN