git rebase -i允许您方便地编辑除根提交之外的任何先前提交。以下命令显示如何手动执行此操作。# tag the old root, "git rev-list ..." will return the hash of first commitgit tag root `git rev-list HEAD | tail -1`# switch to a new branch pointing at the first commitgit checkout -b new-root root# make any edits and then commit them with:git commit --amend# check out the previous branch (i.e. master)git checkout @{-1}# replace old root with amended versiongit rebase --onto new-root root# you might encounter merge conflicts, fix any conflicts and continue with:# git rebase --continue# delete the branch "new-root"git branch -d new-root# delete the tag "root"git tag -d root