git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* mirroring and development with three levels of repositories?
@ 2010-09-28 17:25 John Clemens
  2010-09-28 17:37 ` Enrico Weigelt
  0 siblings, 1 reply; 5+ messages in thread
From: John Clemens @ 2010-09-28 17:25 UTC (permalink / raw)
  To: git

Apologies in advance for the long question.  I'm obviously doing something
wrong, but I'm not sure what and searching hasn't provided me with anything.
If there is a git-users mailing list this would be more appropriate for,
please tell me.

Short question:
It it possible for a bare repository to have both local (company-wide) and
remote (mirroring upstream) branches, as well as serving those branches to our
devs? If so, how?

Long question:

We're working on a project that's a collaboration between several companies.
The full tree for everyone is stored on a central server that, for firewall
reasons, only one person can access in the company.  So, that person creates
and updates nightly a local mirror of the central server.  We then have a few
branches of our own that we do development on inside the company, and
periodically merge those branches into the main ones and push them upstream.

In mercurial, we do the branching by cloning the local mirror on our internal
server, having the devs push and pull from that repo, and then pushing those
changes to our local mirror, which gets pushed to the central server.

Now the central server has some things using git, and the git repo has
6 branches within it, as opposed to individual repos.  The setup looks
like this:

+----------+
| upstream |  <--- contains tree with 6 branches
+----------+
    |
------------- <---- firewall
    |
+--------------+
| Local Mirror | <--- "git clone --mirror" from upstream.
+--------------+
    |
    |---------|
  +-----+     +-----+
  | dev |     | dev |
  +-----+     +-----+

I would like to create two company-wide branches here that remain local,
one that branches from upstream's HEAD, and one that branches from one
of the existing branches on upstream (call it branch-a). I then want the devs
to be able to git clone our mirror, and then switch to our company-local branch
and hack away, putting thier changes on the company-wide server.

I thought I'd do this in git by the following:

(on client/dev machine):
$ git clone http://local-server/local-mirror.git

For later reference:
$ git remote show origin
* remote origin
  Fetch URL: http://local-server/local-mirror.git
  Push  URL: http://local-server/local-mirror.git
  HEAD branch: xxx/stable
  Remote branches:
    feature             tracked
    branch-a            tracked
    xxx/master          tracked
    xxx/feature1        tracked
    xxx/feature2        tracked
    xxx/stable          tracked
  Local branch configured for 'git pull':
    xxx/stable merges with remote xxx/stable
  Local ref configured for 'git push':
    xxx/stable pushes to xxx/stable (up to date)

Then, we create a new branch and push it to the server:

$ git branch company-name/test1
$ git push origin company-name/test1

So far, so good, gitweb shows the new beanch in the mirror, pointing to
HEAD.  Now lets create and push the other new company-wide branch:

$ git checkout -b company-name/branch-a origin/branch-a
$ git push origin company-name/branch-a

Again, all seems well.  gitweb shows the new company-name/* branches on the
local server.

However, when you do a new clone of the local mirror, it now fails:

$ git clone http://local-server/local-mirror.git
Initialized empty Git repository in /home/clemej/git/local-mirror/.git/
warning: remote HEAD refers to nonexistent ref, unable to checkout.

$ git branch -a
remotes/origin/company-name/test1
remotes/origin/company-name/branch-a

Note the distinct absense of all the other branches in the repository.

$ git remote show origin
* remote origin
  Fetch URL: http://local-server/local-mirror.git
  Push  URL: http://lodql-server/local-mirror.git
  HEAD branch: (unknown)
  Remote branches:
    company-name/test1       tracked
    company-name/branch-a    tracked

Jumping over to the server, we see:

$ cd local-mirror.git/
$ git remote show origin
* remote origin
  Fetch URL: http://upstream/tree.git
  Push  URL: http://upstream/tree.git
  HEAD branch: xxx/stable
  Remote branches:
    company-name/test1       stale (use 'git remote prune' to remove)
    company-name/branch-a    stale (use 'git remote prune' to remove)
    feature             tracked
    branch-a            tracked
    xxx/master          tracked
    xxx/feature1        tracked
    xxx/feature2        tracked
    xxx/stable          tracked
  Local refs will be mirrored by 'git push'

So, I'm obviously not thinking about this the right way.  It it possible
for a bare repository to have both local (company-wide) and remote (mirroring
upstream) branches, as well as serving those branches to our devs?  If so, how?

Thanks for your time,
john.c

-- 
John Clemens <clemej@gmail.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-09-29  1:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-28 17:25 mirroring and development with three levels of repositories? John Clemens
2010-09-28 17:37 ` Enrico Weigelt
2010-09-28 18:27   ` John Clemens
2010-09-28 18:41     ` Enrico Weigelt
2010-09-29  1:58       ` John Clemens

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).