From: Linus Torvalds <torvalds@linux-foundation.org>
To: "Björn Steinbrink" <B.Steinbrink@gmx.de>
Cc: "Craig L. Ching" <cching@mqsoftware.com>,
sverre@rabbelier.nl, Git Mailinglist <git@vger.kernel.org>
Subject: Re: Monotone workflow compared to Git workflow ( was RE: Git vs Monotone)
Date: Thu, 31 Jul 2008 14:13:06 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.1.10.0807311357430.3277@nehalem.linux-foundation.org> (raw)
In-Reply-To: <20080731205400.GA7911@atjola.homenet>
On Thu, 31 Jul 2008, Björn Steinbrink wrote:
> >
> > So literally, if you do
> >
> > git clone <cntral-repo-over-network> <local>
>
> Hum, I guess I'm just missing something and prepare to get flamed, but
> wouldn't you want that one to be bare? Otherwise, the other clones won't
> see all of the original repo's branches, right?
Making it bare might be a good idea for other reasons too (it makes it
much more obvious that it's a "local clone" and is somehow special). But
it's really a matter of taste - and the project - exactly how you do it.
For example, the kernel only has a single master branch in the top repo,
so there it really doesn't matter, and yes, I'm more kernel-oriented than
anything else, of course.
But I don't think it's exactly wrong to have the initial clone be a real
repository that you do work in. Quite often the history really is the
_bulk_ of the database by far (at least with projects that have big enough
repositories for this to even matter in the first place!), and as long as
you just download that once and share that thing, you're already ahead of
the game and the rest is really just details.
> Maybe even better:
>
> mkdir local-mirror
> cd local-mirror
> git --bare init
> git remote add -f --mirror origin <central-repo-over-network>
>
> A cronjob (or whatever) could keep the local mirror up-to-date and the
> other repos can fetch from there.
Heh. You can certainly do it many ways. I suspect the _easiest_ model is
actually to do one single local repo that is special (and perhaps bare),
and then you can clone all the other ones with
git clone --reference <local-reference> <remote> <new-local>
because that will automatically set up the new local repo to have the
local reference as an alternates thing, and will avoid downloading
unnecessary stuff.
So my point about the eleven repos was not that it's the best way to do
one remote clone and then eleven local ones - my point was that even if
you do that _stupid_ thing, you'd have seen sharing without even knowing
what you really did.
If you want to explicitly share, I think the local bare reference and
using "git clone --reference" is the best way. It sets up a special
link-file (it's just a text-file that git knows about, so it should work
fine under Windows too - no need for filesystem support) in
.git/objects/info/alternates.
IOW, git-clone --reference works like "git clone -s", but does so with one
special local database, while allowing you to clone from anywhere. Very
convenient.
And no, I don't think we document all these "tricks" very well. Partly
because people are _already_ complaining about how git can do so many
things ;) But partly because if you don't know what you're doing, the
"tricks" are often things you really need to understand, and can be a bit
dangerous otherwise.
For example, the "git clone -s" (or --reference) thing is *very* useful,
but one result of other repositories then sharing a database with the
reference one is that suddenly the reference repo is very special. You
must not remove it (obviously!), but you also must not rebase it and prune
it etc.
So all the normal git workflows are at least designed to be _safe_ even in
the absense of people not knowing what they are doing. The duplication may
be using harddisk space, but
- quite often the checkout is actually an even bigger issue, and the git
repo is small enough that lots of people don't really worry.
- duplicating the repo also means that you cannot _possibly_ screw up
other people/repos and does give you a kind of backup (even if
same-disk backups are obviously of dubious use: they shouldn't be your
_primary_ backup, but having multiple copies on a single disk still
protects against a _lot_ of problems)
so... It's a trade-off.
Linus
next prev parent reply other threads:[~2008-07-31 21:17 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-31 18:13 Git vs Monotone Sverre Rabbelier
2008-07-31 18:33 ` Stephen R. van den Berg
2008-07-31 18:52 ` Petr Baudis
2008-07-31 19:02 ` Jeff King
2008-07-31 19:11 ` Craig L. Ching
2008-07-31 19:19 ` Sverre Rabbelier
2008-07-31 20:32 ` Jeff King
2008-07-31 19:17 ` Linus Torvalds
2008-07-31 19:28 ` Craig L. Ching
2008-07-31 19:52 ` Linus Torvalds
2008-07-31 20:24 ` Junio C Hamano
2008-07-31 20:30 ` Linus Torvalds
2008-08-23 19:23 ` Felipe Contreras
2008-07-31 20:42 ` Blum, Robert
2008-08-10 22:15 ` Robin Rosenberg
2008-08-01 9:57 ` David Kastrup
2008-07-31 19:48 ` Monotone workflow compared to Git workflow ( was RE: Git vs Monotone) Craig L. Ching
2008-07-31 20:09 ` Linus Torvalds
2008-07-31 20:18 ` Shawn O. Pearce
2008-07-31 20:37 ` Craig L. Ching
2008-07-31 20:54 ` Björn Steinbrink
2008-07-31 21:10 ` Avery Pennarun
2008-07-31 21:13 ` Linus Torvalds [this message]
2008-07-31 21:43 ` Martin Langhoff
2008-07-31 21:40 ` Linus Torvalds
2008-08-01 2:50 ` Dmitry Torokhov
2008-08-01 3:02 ` Linus Torvalds
2008-08-01 3:59 ` Linus Torvalds
2008-07-31 20:57 ` Sean Estabrooks
2008-07-31 21:22 ` Theodore Tso
2008-07-31 19:24 ` Git vs Monotone Theodore Tso
2008-08-01 7:23 ` Sverre Rabbelier
2008-08-01 18:00 ` Daniel Barkalow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.1.10.0807311357430.3277@nehalem.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=B.Steinbrink@gmx.de \
--cc=cching@mqsoftware.com \
--cc=git@vger.kernel.org \
--cc=sverre@rabbelier.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).