{"thread":{"id":"26645","subject":"Adding non-bare branches to a non-bare repository","startedAt":"2011-03-03T10:53:35Z","lastAt":"2011-03-06T23:23:26Z","messageCount":3,"participants":["mail@samtuke.com","Michael J Gruber","Neal Kreitzinger"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"162716","messageId":"201103031053.35864.mail@samtuke.com","threadId":"26645","inReplyTo":null,"subject":"Adding non-bare branches to a non-bare repository","fromName":"mail@samtuke.com","fromEmail":"mail@samtuke.com","sentAt":"2011-03-03T10:53:35Z","receivedAt":"2011-03-03T10:53:35Z","isPatch":false,"sender":{"key":"mail@samtuke.com","avatar":null},"body":"Hi,\n\nMy website is a non-bare git repository. I have a copy of the website for \ntesting purposes which is a separate git repository. Currently these two \nrepositories are not aware of each other, and I copy across files from one to \nthe other in order to bring features from the test repo into the live site.\n\nI would like to make the testing repository into a branch of the live website \nrepository so that I can easily merge in changes from one to the other.\n\nBoth repositories need to be complete copies of files as they are web \naccessible and must be functional.\n\nIs this possible?\n\nIn future I also need to make a third copy of the site to have a beta as well \nas an alpha testing copy of the website.\n\nThanks,\n\nSam.\n"},{"id":"162722","messageId":"4D6FA465.2060703@drmicha.warpmail.net","threadId":"26645","inReplyTo":"201103031053.35864.mail@samtuke.com","subject":"Re: Adding non-bare branches to a non-bare repository","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-03-03T14:23:33Z","receivedAt":"2011-03-03T14:23:33Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"mail@samtuke.com venit, vidit, dixit 03.03.2011 11:53:\n> Hi,\n> \n> My website is a non-bare git repository. I have a copy of the website for \n> testing purposes which is a separate git repository. Currently these two \n> repositories are not aware of each other, and I copy across files from one to \n> the other in order to bring features from the test repo into the live site.\n> \n> I would like to make the testing repository into a branch of the live website \n> repository so that I can easily merge in changes from one to the other.\n> \n> Both repositories need to be complete copies of files as they are web \n> accessible and must be functional.\n> \n> Is this possible?\n> \n> In future I also need to make a third copy of the site to have a beta as well \n> as an alpha testing copy of the website.\n\nYou probably should replace \"branch\" by \"clone\" in all that you have\nsaid above.\n\nThere is no problem adding a non-bare repo as a new remote to an\nexisting non-bare repo. You can easily fetch from such a repo. The only\nproblematic thing is pushing to a branch in a remote repo which is\nchecked out there.\n\nMichael\n"},{"id":"162887","messageId":"4D74176E.8050205@gmail.com","threadId":"26645","inReplyTo":"201103031053.35864.mail@samtuke.com","subject":"Re: Adding non-bare branches to a non-bare repository","fromName":"Neal Kreitzinger","fromEmail":"nkreitzinger@gmail.com","sentAt":"2011-03-06T23:23:26Z","receivedAt":"2011-03-06T23:23:26Z","isPatch":false,"sender":{"key":"nkreitzinger@gmail.com","avatar":null},"body":"On 3/3/2011 4:53 AM, mail@samtuke.com wrote:\n> My website is a non-bare git repository. I have a copy of the website for\n> testing purposes which is a separate git repository. Currently these two\n> repositories are not aware of each other, and I copy across files from one to\n> the other in order to bring features from the test repo into the live site.\n>\n> I would like to make the testing repository into a branch of the live website\n> repository so that I can easily merge in changes from one to the other.\n>\n> Both repositories need to be complete copies of files as they are web\n> accessible and must be functional.\n>\n> Is this possible?\n>\n> In future I also need to make a third copy of the site to have a beta as well\n> as an alpha testing copy of the website.\n\nI recommend re-creating beta repo as a git-clone or linux copy (cp -r \nprod-repo beta-repo) so that beta repo shares the same history as \nprod-repo.  If you have stuff on beta-repo not yet in prod-repo then tar \nit up and \"re-apply\" it to the \"new\" beta-repo using the \"vendor branch\" \nmethodology described in the git-rm manpage.  (do likewise for \nalpah-repo  -- clone/copy it from prod-repo and apply beta-repo \nadditional commits via method described below.)\n\nYou can create an \"integration\" repo to perform merges between the \nproduction repo and the beta repo (and alpha repo):\n(1) clone the integration repo from the production repo.  this is \nimportant because it will cause the integration repo master branch to \ncorrelate to the production repo master branch which is the \"real\" \nmaster branch or \"ultimate\" master branch.\n(2) add the beta repo as a remote to the integration repo.\ne.g. (a) git remote add -t master BETA git:///url.to.beta\n(b) git fetch BETA --no-tags\n(c) git branch beta-master remotes/BETA/master\n(this will track the master branch of the beta repo in the beta-master \nbranch of the integration repo)\n(d) after initial creation of beta-master via (a thru c) you update \nbeta-master with:  (d1) git checkout beta-master\n(d2) git pull BETA\n(3) now you can merge beta-master into master and then push master to \nthe production repo.  i imagine that beta-master will always be built on \nmaster so the merge should always resolve as a fastforward:\n(a) git checkout master\n(b) git merge --ff-only beta-master\n(b1) you should set production repo to deny non-fastforwards. see \ngit-config manpage.\n(c) git push origin HEAD (assuming you leave the default name of the \nremote to the production repo as \"origin\")\n\nFor the alpha-repo you can do the same steps but point to the url for \nthe alpha repo and call the remote handle ALPHA.   Call the tracking \nbranch of the ALPHA master branch \"alpha-master\" in your integration \nrepo and merge it into beta-master.  However, when you push beta-master \nto the master branch of BETA you will need to specify a specific syntax \nso it pushes \"beta-master\" to the \"master\" branch on BETA instead of \ncreating a new branch called \"beta-master\" on BETA.  Look at the git \npush manpage for the syntax.\n\nHope this helps.\n\nv/r,\nneal\n"}]}