Re: Managing multiple branches in git

From: Aidan Van Dyk <aidan(at)highrise(dot)ca>
To: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Managing multiple branches in git
Date: 2009-06-02 16:23:48
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

* David E. Wheeler <david(at)kineticode(dot)com> [090602 11:56]:
> On Jun 2, 2009, at 8:43 AM, Tom Lane wrote:
>> Each of these is configured (using --prefix) to install into a
>> separate
>> installation tree. So I can switch my attention to one branch or
>> another by cd'ing to the right place and adjusting a few environment
>> variables such as PATH and PGDATA.
> Yeah, with git, rather than cd'ing to another directory, you'd just do
> `git checkout rel8_3` and work from the same directory.

But that looses his "configured" and "compiled" state...

But git isn't forcing him to change his workflow at all...

He *can* keep completely separate "git repositories" for each release
and work just as before. This will carry with it a full "separate"
history in each repository, and I think that extra couple hundred MB is
what he's hoping to avoid.

But git has concepts of "object alternates" and "reference
repositories". To mimic your workflow, I would probably do something

## Make my reference repository, cloned from "offical" where everyone pushes
mountie(at)pumpkin:~/projects/postgresql$ git clone --bare --mirror git:// PostgreSQL.git

## Make my local master development repository
mountie(at)pumpkin:~/projects/postgresql$ git clone --reference PostgreSQL.git git:// master
Initialized empty Git repository in /home/mountie/projects/postgresql/master/.git/

## Make my local REL8_3_STABLE development repository
mountie(at)pumpkin:~/projects/postgresql$ git clone --reference PostgreSQL.git git:// REL8_3_STABLE
Initialized empty Git repository in /home/mountie/projects/postgresql/REL8_3_STABLE/.git/
mountie(at)pumpkin:~/projects/postgresql$ cd REL8_3_STABLE/
mountie(at)pumpkin:~/projects/postgresql/REL8_3_STABLE$ git checkout --track -b REL8_3_STABLE origin/REL8_3_STABLE
Branch REL8_3_STABLE set up to track remote branch refs/remotes/origin/REL8_3_STABLE.
Switched to a new branch 'REL8_3_STABLE'

Now, the master/REL8_3_STABLE directories are both complete git
repositories, independant of eachother, except that they both reference
the "objects" in the PostgreSQL.git repository. They don't contain the
historical objects in their own object store. And I would couple that
with a cronjob:

*/15 * * * git --git-dir=$HOME/projects/postgresql/PostgreSQL.git fetch --quiet

which will keep my "reference" project up2date (a la rsync-the-CVSROOT,
or cvsup-a-mirror anybody currently has when working with CVS)...

Then Tom can keep working pretty much as he currently does.


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

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Page 2009-06-02 16:23:51 Re: Managing multiple branches in git
Previous Message Marko Kreen 2009-06-02 16:17:22 Re: PostgreSQL Developer meeting minutes up