Insert a commit before the root commit in Git?

I’ve asked before about how to squash the first two commits in a git repository.

While the solutions are rather interesting and not really as mind-warping as some other things in git, they’re still a bit of the proverbial bag of hurt if you need to repeat the procedure many times along the development of your project.

So, I’d rather go through pain only once, and then be able to forever use the standard interactive rebase.

What I want to do, then, is to have an empty initial commit that exists solely for the purpose of being the first. No code, no nothing. Just taking up space so it can be the base for rebase.

My question then is, having an existing repository, how do I go about inserting a new, empty commit before the first one, and shifting everyone else forward?

15 Answers
15

Leave a Comment