Re: Managing multiple branches in git

From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Mark Mielke <mark(at)mark(dot)mielke(dot)cc>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Managing multiple branches in git
Date: 2009-06-02 23:22:42
Message-ID: B208DD5A-BEE7-41F0-A4A1-524401BD47DE@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Jun 2, 2009, at 4:13 PM, Tom Lane wrote:

> I think you missed the part of the discussion about not wishing to
> share
> a single working directory across all the branches.

No, I was just ignoring it for the moment to focus on the commit and
history issue.

> The time to rebuild
> derived files whenever I switch branches is simply too great with that
> approach. I want a working copy per branch, and some
> not-impossibly-complicated scheme for managing the pulls/commits/
> pushes
> given that environment.

It seems that there are a few approaches, but simplest is probably to
create a clone of the upstream repository for each branch and work in
them as if they were separate repositories:

git clone git(at)git(dot)postgresql(dot)org/postgresql.git master
git clone git(at)git(dot)postgresql(dot)org/postgresql.git rel8_3
cd rel8_3
git checkout --track -b rel8_3 origin/rel8_3

Then you can make your changes in master and push them back to origin
when you're done, then backpatch in the rel8_3 checkout and commit
with the same commit message. The next time you do a `git pull` in
master, it will also pull down the changes you committed in rel8_3, so
you'll have a complete history. From there it's just a matter of
scripting `git log` in a way to make it easy for you to create changes
files.

Does that make sense?

Best,

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeremy Kerr 2009-06-02 23:33:21 [PATCH v2] Add bit operations util header
Previous Message Tom Lane 2009-06-02 23:13:56 Re: Managing multiple branches in git