Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Post History

77%
+5 −0
Q&A What are the benefits of starting a Git repo with an empty commit?

Found an article about starting a repo with an empty commit. Read the post a couple of times, but still don't understand the reasoning: 1. git log and other commands blow up with terrifying ...

2 answers  ·  posted 6mo ago by toraritte‭  ·  last activity 6mo ago by Michael‭

Question git
#1: Initial revision by user avatar toraritte‭ · 2023-11-08T14:13:08Z (6 months ago)
What are the benefits of starting a Git repo with an empty commit?
Found an article about [starting a repo with an empty commit](https://web.archive.org/web/20170919074934/http://bit-booster.com:80/doing-git-wrong/2017/01/02/git-init-empty/). Read the post a couple of times, but still don't understand the reasoning:

1. > ##### 1. `git log` and other commands blow up with terrifying error messages.
   > ##### 2. You can’t `git reset` back to that initial state.

   Based on the first 2 section titles above I suspected that this may be a satirical writing.

2. > ##### 3. You can’t rebase the initial commit.

   This however seems like a valid point (echoed by a linked article, [Lesser Known Git Commands](https://hackernoon.com/lesser-known-git-commands-151a1918a60#h-git-it), found in the original post), but when I start thinking about it, I just can't see how this is useful in practice (or what it tries to prevent).

3. Linked in the original post: [(2008?) Git Magic - Appendix A. Git Shortcomings: Initial Commit](http://www-cs-students.stanford.edu/~blynn/gitmagic/apa.html#_initial_commit)

   I agree with the "counting from 0" sentiment, but still don't get what would be the benefits of an empty initial commit, other than being pedantic.

4. Linked in the original post: [(2010) How I initialize my Git repositories | Kevin Deldycke](https://kevin.deldycke.com/2010/05/initialize-git-repositories/)

   This post does give a rationale for using this trick for code archeology purposes (still don't get the specifics, but I understand that this is for a special use case).

Links in items 3. and 4. are obviously dated and this whole idea obviously never took off(?), but I'm still wondering if there is still a benefit to it - or the changes in Git since then obviate its necessity.

---

Of course, after typing all this did I find the SO threads:

+ [Insert a commit before the root commit in Git?](https://stackoverflow.com/questions/645450/) 
+ [How do I git rebase the first commit?](https://stackoverflow.com/questions/22992543)

Both have the main theme of "_How to rebase the whole history, **including** the first commit?_".



git