Let's say you've created a git repo and committed several changes, but then you realize that your global username and e-mail address settings aren't correct, and you need to change all the commits. How can that be done? Is it as easy as changing your global settings, then doing a git rebase --interactive?
Now what if that repo was pushed to GitHub. Luckily, no one else has made changes to that repo or forked it. Is the easiest fix just to nuke the repo on GitHub and then re-create it?
You can use git filter-branch like (modify "New Name" and "[email protected]"):
git filter-branch --commit-filter 'export GIT_AUTHOR_NAME="New Name"; export GIT_AUTHOR_EMAIL="[email protected]"; git commit-tree "$@"'
If you do not want to do the whole branch you can add a revision range at the end (reva will not be touched):
git filter-branch --commit-filter 'export GIT_AUTHOR_NAME="New Name"; export GIT_AUTHOR_EMAIL="[email protected]"; git commit-tree "$@"' reva..revb
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With