git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Adding non-bare branches to a non-bare repository
@ 2011-03-03 10:53 mail
  2011-03-03 14:23 ` Michael J Gruber
  2011-03-06 23:23 ` Neal Kreitzinger
  0 siblings, 2 replies; 3+ messages in thread
From: mail @ 2011-03-03 10:53 UTC (permalink / raw)
  To: git

Hi,

My website is a non-bare git repository. I have a copy of the website for 
testing purposes which is a separate git repository. Currently these two 
repositories are not aware of each other, and I copy across files from one to 
the other in order to bring features from the test repo into the live site.

I would like to make the testing repository into a branch of the live website 
repository so that I can easily merge in changes from one to the other.

Both repositories need to be complete copies of files as they are web 
accessible and must be functional.

Is this possible?

In future I also need to make a third copy of the site to have a beta as well 
as an alpha testing copy of the website.

Thanks,

Sam.

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

* Re: Adding non-bare branches to a non-bare repository
  2011-03-03 10:53 Adding non-bare branches to a non-bare repository mail
@ 2011-03-03 14:23 ` Michael J Gruber
  2011-03-06 23:23 ` Neal Kreitzinger
  1 sibling, 0 replies; 3+ messages in thread
From: Michael J Gruber @ 2011-03-03 14:23 UTC (permalink / raw)
  To: mail@samtuke.com; +Cc: git

mail@samtuke.com venit, vidit, dixit 03.03.2011 11:53:
> Hi,
> 
> My website is a non-bare git repository. I have a copy of the website for 
> testing purposes which is a separate git repository. Currently these two 
> repositories are not aware of each other, and I copy across files from one to 
> the other in order to bring features from the test repo into the live site.
> 
> I would like to make the testing repository into a branch of the live website 
> repository so that I can easily merge in changes from one to the other.
> 
> Both repositories need to be complete copies of files as they are web 
> accessible and must be functional.
> 
> Is this possible?
> 
> In future I also need to make a third copy of the site to have a beta as well 
> as an alpha testing copy of the website.

You probably should replace "branch" by "clone" in all that you have
said above.

There is no problem adding a non-bare repo as a new remote to an
existing non-bare repo. You can easily fetch from such a repo. The only
problematic thing is pushing to a branch in a remote repo which is
checked out there.

Michael

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

* Re: Adding non-bare branches to a non-bare repository
  2011-03-03 10:53 Adding non-bare branches to a non-bare repository mail
  2011-03-03 14:23 ` Michael J Gruber
@ 2011-03-06 23:23 ` Neal Kreitzinger
  1 sibling, 0 replies; 3+ messages in thread
From: Neal Kreitzinger @ 2011-03-06 23:23 UTC (permalink / raw)
  To: mail@samtuke.com; +Cc: git

On 3/3/2011 4:53 AM, mail@samtuke.com wrote:
> My website is a non-bare git repository. I have a copy of the website for
> testing purposes which is a separate git repository. Currently these two
> repositories are not aware of each other, and I copy across files from one to
> the other in order to bring features from the test repo into the live site.
>
> I would like to make the testing repository into a branch of the live website
> repository so that I can easily merge in changes from one to the other.
>
> Both repositories need to be complete copies of files as they are web
> accessible and must be functional.
>
> Is this possible?
>
> In future I also need to make a third copy of the site to have a beta as well
> as an alpha testing copy of the website.

I recommend re-creating beta repo as a git-clone or linux copy (cp -r 
prod-repo beta-repo) so that beta repo shares the same history as 
prod-repo.  If you have stuff on beta-repo not yet in prod-repo then tar 
it up and "re-apply" it to the "new" beta-repo using the "vendor branch" 
methodology described in the git-rm manpage.  (do likewise for 
alpah-repo  -- clone/copy it from prod-repo and apply beta-repo 
additional commits via method described below.)

You can create an "integration" repo to perform merges between the 
production repo and the beta repo (and alpha repo):
(1) clone the integration repo from the production repo.  this is 
important because it will cause the integration repo master branch to 
correlate to the production repo master branch which is the "real" 
master branch or "ultimate" master branch.
(2) add the beta repo as a remote to the integration repo.
e.g. (a) git remote add -t master BETA git:///url.to.beta
(b) git fetch BETA --no-tags
(c) git branch beta-master remotes/BETA/master
(this will track the master branch of the beta repo in the beta-master 
branch of the integration repo)
(d) after initial creation of beta-master via (a thru c) you update 
beta-master with:  (d1) git checkout beta-master
(d2) git pull BETA
(3) now you can merge beta-master into master and then push master to 
the production repo.  i imagine that beta-master will always be built on 
master so the merge should always resolve as a fastforward:
(a) git checkout master
(b) git merge --ff-only beta-master
(b1) you should set production repo to deny non-fastforwards. see 
git-config manpage.
(c) git push origin HEAD (assuming you leave the default name of the 
remote to the production repo as "origin")

For the alpha-repo you can do the same steps but point to the url for 
the alpha repo and call the remote handle ALPHA.   Call the tracking 
branch of the ALPHA master branch "alpha-master" in your integration 
repo and merge it into beta-master.  However, when you push beta-master 
to the master branch of BETA you will need to specify a specific syntax 
so it pushes "beta-master" to the "master" branch on BETA instead of 
creating a new branch called "beta-master" on BETA.  Look at the git 
push manpage for the syntax.

Hope this helps.

v/r,
neal

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

end of thread, other threads:[~2011-03-06 23:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-03 10:53 Adding non-bare branches to a non-bare repository mail
2011-03-03 14:23 ` Michael J Gruber
2011-03-06 23:23 ` Neal Kreitzinger

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