Thread (1 message) 1 message, 1 author, 2016-06-15

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:
Matthieu Moy [off-list ref] writes:
quoted
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.
You are still wrong.

The most natural is to create a commit in a non-bare repository
you create, and push into a bare empty repository.
Yes, we agree on that point.

But I do find (incorrect with current git)

(1)

$ mkdir ~/bare-repo
$ cd ~/bare-repo
$ git --bare init
$ cd
$ git clone bare-repo local/non-bare
$ cd local/non-bare
<put files, git add, git commit>
$ git push

Simpler than (valid with current git)

(2)

$ mkdir ~/bare-repo
$ cd ~/bare-repo
$ git --bare init
$ cd
$ mkdir local/non-bare
$ cd local/non-bare
$ git init
<put files, git add, git commit>
$ git push ~/bare-repo
$ git remote add origin ~/bare-repo
$ git config branch.master.remote origin
$ git config branch.master.merge refs/heads/master

Where the bare-ness of ~/bare-repo matters is that with a bare
repository, I could have actually created the initial commit there
(valid with current git too):

(3)

$ mkdir ~/non-bare-repo
$ cd ~/non-bare-repo
$ git init
<put files, git add, git commit>
$ cd
$ git clone bare-repo local/non-bare
The repository that is pushed into can be non-bare, but bareness of
that does _NOT_ matter.
Either there is a way to achive (3) above with a bare repository which
I don't know, or bare-ness does matter in this case.

-- 
Matthieu
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help