{"thread":{"id":"23712","subject":"newbie: should git bare repositories (forked ones) have an origin defined?","startedAt":"2010-05-05T16:40:28Z","lastAt":"2010-05-06T00:49:29Z","messageCount":2,"participants":["Robert Buck","Dmitrijs Ledkovs"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"140999","messageId":"q2r408104421005050940k2d054b20zad05552623ba2338@mail.gmail.com","threadId":"23712","inReplyTo":null,"subject":"newbie: should git bare repositories (forked ones) have an origin defined?","fromName":"Robert Buck","fromEmail":"buck.robert.j@gmail.com","sentAt":"2010-05-05T16:40:28Z","receivedAt":"2010-05-05T16:40:28Z","isPatch":false,"sender":{"key":"buck.robert.j@gmail.com","avatar":"https://gravatar.com/avatar/1686742e8ac2595378aac67f26fd638ddaf494194f9af0cb6082c4a7eca1a366?d=mp&s=160"},"body":"Yesterday I forwarded a question related to setting up public\nrepositories and flows. Related to that question, and central to one\npoint I do not understand, is not so much the role of origins, but\nrather their application.\n\nGiven the following scenario, who defines origins, and where?\n\nrepositories : product.git, product-next.git,\nproduct-story-or-module.git, product-maint.git\n\nThe idea here would be to have product-next.git and product-maint.git\nrepositories to be public repositories forked from product.git.\n\nWhat I have read in the Oreilly Git book is that when you `init\n--bare` there are no defined remotes, nor are there any branches. So\nhow specifically should these repositories be set up?\n\nHere is a guess, but likely incorrect...\n\nMaster:\n\ngit init --bare product.git\ngit init product-init.git\ncd product-init.git\ngit remote add origin ../product.git\ntouch README\necho \"hello world\" > README\ngit add README\ngit commit -m \"initial checkin\"\ngit push origin master\n\nNext:\n\ngit clone --bare --no-checkout product.git product-next.git\ncd product-next.git\ngit remote add upstream ../product.git\n\nComments:\n\nWhen I create a local clone of \"next\" and inquire about remote refs,\nthere are none for \"upstream\". What I had thought was that by adding\nin predefined remote refs into the forked repository itself that when\ndevelopers clone from it they would get those predefined refs for\nfree, so they could immediately make use of \"upstream\" in push/pull\noperations.\n\nQuestion:\n\nIs what I am inquiring about reasonable, or is there a good reason to\nnot have remote refs embedded into the public forked repository?\nHow should public forked repositories (\"next\" in the use case above)\nbe initially created on its host?\n\nThank you,\n\nBob\n"},{"id":"141021","messageId":"u2n86ecb3c71005051749m95977244oa5c5ee809599dc4c@mail.gmail.com","threadId":"23712","inReplyTo":"q2r408104421005050940k2d054b20zad05552623ba2338@mail.gmail.com","subject":"Re: newbie: should git bare repositories (forked ones) have an origin defined?","fromName":"Dmitrijs Ledkovs","fromEmail":"dmitrij.ledkov@ubuntu.com","sentAt":"2010-05-06T00:49:29Z","receivedAt":"2010-05-06T00:49:29Z","isPatch":false,"sender":{"key":"dmitrij.ledkov@ubuntu.com","avatar":"https://gravatar.com/avatar/79b618c6eb391ddb486c2ee0d3b429014e0e9ba579fd55f2e035f482fc8c24f4?d=mp&s=160"},"body":"On 5 May 2010 17:40, Robert Buck <buck.robert.j@gmail.com> wrote:\n>\n> Question:\n>\n> Is what I am inquiring about reasonable, or is there a good reason to\n> not have remote refs embedded into the public forked repository?\n> How should public forked repositories (\"next\" in the use case above)\n> be initially created on its host?\n>\n> Thank you,\n>\n> Bob\n\n\n\"origin\" & \"master\" are just the default names for a remote & where\nHEAD points to on remote repository.\n\n\nA bare repository usually doesn't have any refs/remotes/* instead it\njust has refs/heads/*\n\nWhen you clone a bare repository refs/heads/* from bare repository are\npulled into refs/remotes/<remotename>/*\n\nlook at your .git/config to see how flexible this is.\n\nyou can do\n\n[remote \"qa-branches\"]\n      url = ../qa\n      fetch = +refs/heads/qa-stable:refs/heads/stable\n      fetch = +refs/heads/qa-appprove:refs/heads/next\n      fetch = +refs/heads/qa-pending:refs/heads/dev\n\n[remote \"bob\"]\n      url = ../bob\n      fetch = +refs/heads/qa-rejected:refs/heads/experimental\n\nThis repository can be public and you can have many remotes defined\nall fetching into refs/heads.\n\nNow set-up bare repositories that you like and set-up as many remotes\nas locations you need to fetch from, figure out which heads to you\nneed to fetch & how you want to call them and you are done =)\n"}]}