Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 <>", 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?

share|improve this question
up vote 13 down vote accepted

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.