5 ms·
This might have a serious use. I have a private repo that I worked on with my daughter. If I open source it, ideally I'd keep the chronological history but scru
by brlewis 7y ago
This might have a serious use. I have a private repo that I worked on with my daughter. If I open source it, ideally I'd keep the chronological history but scrub her email address out of it. It's OK that all the commit hashes would change. Would I want to adapt this joke tool to that purpose, or is there an exiting tool for rewriting history that way?
- i_v 7y agoGitHub also supports a special <username>@users.noreply.github.com address if you wanted her to retain semi-anonymous authorship as a GitHub user.
- brlewis 7y agoThe repo is on gitlab, but I can always make up a noreply address.
- klodolph 7y agoThe standard way to do that is with 'git filter-branch'. If your daughter’s email is megatron@example.com, git filter-branch --env-filter ' old_email=megatron@example.com new_email=redacted if [ "$GIT_COMMITTER_EMAIL" = "$old_email" ] ; then export GIT_COMMITTER_EMAIL="$new_email" fi if [ "$GIT_AUTHOR_EMAIL" = "$old_email" ] ; then export GIT_AUTHOR_EMAIL="$new_email" fi ' -- --all This is “safe” in the sense that you can go back to the old version with the reflog if you screw things up.
- saidajigumi 7y agoSeconded. The git blame-someone-else tool is just using git rebase and git commit --amend internally to alter one specified commit. git filter-branch is perfect for this kind of wholesale revision. filter-branch is essential for tasks like: open-sourcing repos that need some kind of cleanup, massaging repos generated by a VCS migration tool, etc. For example, years ago I participated in the move of a large CVS repo to git; there was significant filter-branch post-processing required to create an acceptable baseline)
- owenmarshall 7y agogit filter-branch will solve this for you: https://stackoverflow.com/questions/750172/how-to-change-the-author-and-committer-name-and-e-mail-of-multiple-commits-in-gi https://stackoverflow.com/questions/750172/how-to-change-the...
- justtopostthis3 7y agogit filter-branch --env-filter " \ export GIT_AUTHOR_NAME=Dade\ Murphy \ GIT_AUTHOR_EMAIL=zer0cool@example.com \ GIT_COMMITTER_NAME=Dade\ Murphy \ GIT_COMMITTER_EMAIL=zer0cool@example.com"