Back to News
Advertisement
Advertisement

⚡ Community Insights

Discussion Sentiment

58% Positive

Analyzed from 475 words in the discussion.

Trending Topics

#commit#dates#https#repo#email#project#com#history#authors#sometimes

Discussion (12 Comments)Read Original on HackerNews

iamcoder18about 1 hour ago
This is cool, but has anyone ever needed to rewrite commit authors or dates?
simonw23 minutes ago
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.

fmorel19 minutes ago
git-filter-repo is amazing for the second case. I've used it to split repos and rename folders multiple times.
simonw17 minutes ago
Yeah, I wrote a TIL about that a few years ago: https://til.simonwillison.net/git/rewrite-repo-specific-file...
xp84about 1 hour ago
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 have people delete and re-check-out.

schainks31 minutes ago
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?
blazarquasar27 minutes ago
Yeah, using this tool for example?
webstrand11 minutes ago
Usually its me who has been committing with a bogus email address, because I don't like having my real user/email set in my $HOME/.gitconfig
f1shy42 minutes ago
Yes. Absolutely! Many times I had a wrong configured terminal and messed up the author. Often I work in different projects, privately and in my work, and I use different authors for both
icaseabout 1 hour ago
yes; when i wanted to make it look like i didn’t procrastinate for a week and implement the entire feature in one day
mellosoulsabout 1 hour ago
Hmmm, this seems to be making easy something you normally should not do.
Carrokabout 1 hour ago
So, exactly like a knife? Generally we don't want to cut people open, but when we need to do it, like during surgery, a sharp knife sure helps.
YonathanTesfayeabout 1 hour ago
that's it
YonathanTesfayeabout 1 hour ago
Agreed mostly. The intent is local cleanup before you push like fixing a wrong author email across a batch or dates from a machine with a bad clock
cautiouscatabout 1 hour ago
This looks cool! Are there screenshots available?
YonathanTesfayeabout 1 hour ago
yborisabout 1 hour ago
Please put up this or another screenshot as the first thing you see in the README - please!

I'm reluctant to clone a repository and spend time on it just to find out the project looks crap and I don't want to use it. A screenshot saves other people's time :)

YonathanTesfayeabout 1 hour ago
done
esafakabout 1 hour ago
I'd put that in the repo not here.
YonathanTesfayeabout 1 hour ago
you're right, done
sixtyjabout 1 hour ago
Extra points for the name.
YonathanTesfayeabout 1 hour ago
Appreciate it! pick a commit, stab it
YonathanTesfayeabout 2 hours ago
I built a small Tauri app that just shows your commits in a table and lets you edit message/author/date directly, plus find & replace with regex if you need to fix a bunch at once. It backs up the branch before it rewrites anything doesn't touch file contents, just metadata.