Re: Cloning empty repositories, was Re: What is the idea for bare repositories?
From: Matthieu Moy <hidden>
Date: 2016-06-15 22:43:50
Junio C Hamano [off-list ref] writes:
But both of Johannes's points apply equally well to an empty bare repository and to an empty non bare repository. IOW, bareness does not matter to the suggestion Johannes gave.
He was suggesting to create the initial commit before cloning:
quoted
So you need to populate the repository before starting _anyway_.
To create an initial commit in a non-bare repository, I put files in it, git add, and git commit. To create an initial commit in a bare repository, the most natural way for me is to clone it, create the commit in the clone, and then push. Bare-ness _does_ matter for that. I repeat the use-case I mentionned above : ,---- | a typical use-case is when I want to create a new project. I'd | like to initialize an empty bare repo on my backed up disk, and then | clone it to my local-fast-unreliable disk to get a working copy and do | the first commit there. `---- I find this quite natural, and up to now, no one gave me either a rationale not to do that, or a _simple_ way to achieve this. As I said, it's currently not _very_ hard to do, but I have to edit .git/config by hand, while git clone knows how to do this much faster than I for non-empty repositories. -- Matthieu