Thinking about how to start this blog lead me to remember about something I read a long time ago about git. I can’t find that blog post anymore but I had enough recollection to search my way through google and stackoverflow.
$ git init $ git commit --allow-empty -m "ignition"
This is all swell and good but I couldn’t find an explanation as to why it is a good thing. I like to know why I should do things so I searched a bit more. I think there are two good points:
- some commands break without an initial commit (git log for example). Creating an empty commit puts the repository in a fully working state without having to push any code.
- heavy rebasing with a branch using a different initial commit is problematic.
After tinkering with the idea, I realized that adding an empty commit is like starting your repository from 0 rather than 1. Any developer, except for a few, should see the appeal in this practice.
|||This link is originally about the empty tree SHA1 in git, an interesting internal.|