In some cases, for example at the beginning of a project, you may want to edit the first commit in your git repository.
This commit is a little bit special. He isn’t referenced anywhere and all your commits have it as parent, except if you created an orphan branch.
To edit this root commit, you must use interactive rebase and add the --root
flag.
git rebase -i --root
Choose edit mode on the first commit in the shown list:
edit 1753567 Initialize repository with test.md
pick 8072b82 Add new directory
pick 064294c Add ipmitool article
pick 8da7e71 Add apache introduction article
pick ee849b8 Add postgresql close connections article
pick 1bb9ffb Add postfix introduction
pick fbb574b Forgot article content...
pick 5435a6b Markdown fixes
pick 247c2a0 Add mysql introduction
pick 81ceb8c Add MySQL introduction content
Do your changes, and finish the rebase:
git commit
git rebase --continue