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
Quoting an answer from SO: Perhaps there was an advantage years ago prior to version 1.17.12 which added the --root option to rebase. Nowadays though, I can't think of any reason to start with a...
Answer
#2: Post edited
- Quoting [an answer from SO](https://stackoverflow.com/a/77446640/1498178):
- > Perhaps there was an advantage years ago [prior to version 1.17.12][1] which added the `--root` option to rebase. Nowadays though, I can't think of any reason to start with an empty commit for a *new* repository.
- >
- > However, there may still be some minor advantages when re-organizing *existing* repositories, for example:
- >
- > 1. When combining existing repositories into a monorepo, you could start with one repo and merge in the others, or you could start with an empty commit and merge in each repo to that commit, so the first-parent history is preserved from the point of view of the new monorepo instead of one of the existing repos. It also allows you to provide additional information in the merge commit for bringing in that first repo.
- > 2. When porting source code from SCMs other than Git, some tools may expect a Git anchor commit to work against, so that the loop can be identical for every new commit, rather than having different logic for the initial commit.
- <sup>The linked answer is licensed under CC BY-SA 4.0 and it was quoted verbatim [as it was on 11/8/2023 at 1013](https://web.archive.org/web/20231108151028/https://stackoverflow.com/questions/77446305/what-are-the-benefits-of-starting-a-git-repo-with-an-empty-commit?noredirect=1#comment136533393_77446305). </sup>
- [1]: https://stackoverflow.com/a/14630424/184546
- Quoting [an answer from SO](https://stackoverflow.com/a/77446640/1498178):
- > Perhaps there was an advantage years ago [prior to version 1.17.12][1] which added the `--root` option to rebase. Nowadays though, I can't think of any reason to start with an empty commit for a *new* repository.
- >
- > However, there may still be some minor advantages when re-organizing *existing* repositories, for example:
- >
- > 1. When combining existing repositories into a monorepo, you could start with one repo and merge in the others, or you could start with an empty commit and merge in each repo to that commit, so the first-parent history is preserved from the point of view of the new monorepo instead of one of the existing repos. It also allows you to provide additional information in the merge commit for bringing in that first repo.
- > 2. When porting source code from SCMs other than Git, some tools may expect a Git anchor commit to work against, so that the loop can be identical for every new commit, rather than having different logic for the initial commit.
- <sup>The linked answer is licensed under CC BY-SA 4.0 and it was quoted verbatim [as it was on 11/8/2023 at 1013](https://web.archive.org/web/20231108151028/https://stackoverflow.com/questions/77446305/what-are-the-benefits-of-starting-a-git-repo-with-an-empty-commit?noredirect=1#comment136533393_77446305). </sup>
- Git version 1.7.12, which added `--root`, was released in 2012.
- [1]: https://stackoverflow.com/a/14630424/184546
#1: Initial revision
Quoting [an answer from SO](https://stackoverflow.com/a/77446640/1498178): > Perhaps there was an advantage years ago [prior to version 1.17.12][1] which added the `--root` option to rebase. Nowadays though, I can't think of any reason to start with an empty commit for a *new* repository. > > However, there may still be some minor advantages when re-organizing *existing* repositories, for example: > > 1. When combining existing repositories into a monorepo, you could start with one repo and merge in the others, or you could start with an empty commit and merge in each repo to that commit, so the first-parent history is preserved from the point of view of the new monorepo instead of one of the existing repos. It also allows you to provide additional information in the merge commit for bringing in that first repo. > 2. When porting source code from SCMs other than Git, some tools may expect a Git anchor commit to work against, so that the loop can be identical for every new commit, rather than having different logic for the initial commit. <sup>The linked answer is licensed under CC BY-SA 4.0 and it was quoted verbatim [as it was on 11/8/2023 at 1013](https://web.archive.org/web/20231108151028/https://stackoverflow.com/questions/77446305/what-are-the-benefits-of-starting-a-git-repo-with-an-empty-commit?noredirect=1#comment136533393_77446305). </sup> [1]: https://stackoverflow.com/a/14630424/184546