Re: Managing multiple branches in git

From: Aidan Van Dyk <aidan(at)highrise(dot)ca>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Managing multiple branches in git
Date: 2009-06-02 17:11:19
Message-ID: 20090602171119.GH23972@yugib.highrise.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

* Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> [090602 12:35]:
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> > Hmm, but is there a way to create those clones from a single local
> > "database"?
>
> > (I like the monotone model much better. This mixing of working copies
> > and databases as if they were a single thing is silly and uncomfortable
> > to use.)
>
> I agree, .git as a subdirectory of the working directory doesn't make
> much sense to me.

The main reason why git uses this is that the "index" (git equivilant of
the CVS/*) resides in 1 place instead of in each directory. So, if you
have multiple working directories sharing a single .git, you get them
tromping on each others "index".

That said, you can symlink almost everything *inside* .git to other
repositories.

For instance, if you had the "Reference" repository I shows last time,
instead of doing the "git clone", you could do:

#Make a new REL8_2_STABLE working area
mountie(at)pumpkin:~/pg-work$ REF=$(pwd)/PostgreSQL.git
mountie(at)pumpkin:~/pg-work$ mkdir REL8_2_STABLE
mountie(at)pumpkin:~/pg-work$ cd REL8_2_STABLE/
mountie(at)pumpkin:~/pg-work/REL8_2_STABLE$ git init

# And now make everything point back
mountie(at)pumpkin:~/pg-work/REL8_2_STABLE$ mkdir .git/refs/remotes && ln -s $REF/refs/heads .git/refs/remotes/origin
mountie(at)pumpkin:~/pg-work/REL8_2_STABLE$ rm -Rf .git/objects && ln -s $REF/objects .git/objects
mountie(at)pumpkin:~/pg-work/REL8_2_STABLE$ rmdir .git/refs/tags && ln -s $REF/refs/tags .git/refs/tags
mountie(at)pumpkin:~/pg-work/REL8_2_STABLE$ rm -Rf .git/info && ln -s $REF/info .git/info
mountie(at)pumpkin:~/pg-work/REL8_2_STABLE$ rm -Rf .git/hooks && ln -s $REF/hooks

This will leave you with an independent config, independent index,
independent heads, and independent reflogs, with a shared "remote"
tracking branches, shared "object" store, shared "tags", and shared
hooks.

And make sure you don't purge any unused objects out of any of these
subdirs, because they don't know that the object might be in use in
another subdir... This warning is the one reason why it's usually
recommended to just use a reference repository, and not have to worry..

a.

--
Aidan Van Dyk Create like a god,
aidan(at)highrise(dot)ca command like a king,
http://www.highrise.ca/ work like a slave.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2009-06-02 17:18:46 Re: pg_standby -l might destory the archived file
Previous Message Ron Mayer 2009-06-02 17:10:45 Re: Managing multiple branches in git