This is a related question to How do I edit git’s history to correct an incorrect email address/name. Using git rebase -i <first commit>, git commit --amend --author "Foo <[email protected]>", and git rebase --continue, I was able to fix the logs for all of the commits but the first one. How do I fix the first commit?
Add a comment |
1 Answer
After much trial and error, the following recipe was found to work:
# tag the root-most commit so we can reference it git tag root `git rev-list HEAD | tail -1` # check it out on its own branch git checkout -b new-root root # amend the commit git commit --amend # now you've changed the commit message, so checkout the original branch again git checkout @{-1} # and rebase it onto your new root commit git rebase --onto new-root root # then nuke the temporary branch and tag we created git branch -d new-root git tag -d root true credit should go to drizzd on #git for this answer.