{"thread":{"id":"29357","subject":"fetch for bare repository","startedAt":"2012-01-13T10:42:03Z","lastAt":"2012-01-13T15:18:45Z","messageCount":4,"participants":["Dmitry A. Ashkadov","Carlos Martín Nieto"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"182493","messageId":"4F100A7B.3030001@gmail.com","threadId":"29357","inReplyTo":null,"subject":"fetch for bare repository","fromName":"Dmitry A. Ashkadov","fromEmail":"dmitry.ashkadov@gmail.com","sentAt":"2012-01-13T10:42:03Z","receivedAt":"2012-01-13T10:42:03Z","isPatch":false,"sender":{"key":"dmitry.ashkadov@gmail.com","avatar":null},"body":"Hello!\n\nI can't understand how to fetch branches from external repository for \nbare repository.\n\nFor example, imagine 2 git repositories: \"B\" and \"C\". \"B\" repository is \nexternal repository and it contains branch \"branch1\". \"C\" is an internal \nrepository (special repository for some people). \"C\" repository may be \ncreated with command:\n> $ git clone --bare B .\nFor \"C\" repository working set isn't required, so it may be bare, I \nthink. This new \"C\" repository contains branch \"branch1\".\nImagine that somebody has created a new branch \"branch2\" in the \nrepository \"B\". I don't know what I should do with repository \"C\" to \nmake the branch \"branch2\" available on repository \"C\". Command:\n> $ git fetch origin \ndoesn't work. Next command for repository \"C\":\n> $ git branch -a \nalways shows only branch \"branch1\"  but never branch \"branch2\".\n\nCould you help me, please?\n\nThank you!\n"},{"id":"182495","messageId":"20120113134058.GB2850@centaur.lab.cmartin.tk","threadId":"29357","inReplyTo":"4F100A7B.3030001@gmail.com","subject":"Re: fetch for bare repository","fromName":"Carlos Martín Nieto","fromEmail":"cmn@elego.de","sentAt":"2012-01-13T13:40:59Z","receivedAt":"2012-01-13T13:40:59Z","isPatch":false,"sender":{"key":"cmn@elego.de","avatar":"https://avatars.githubusercontent.com/u/335443?v=4"},"body":"On Fri, Jan 13, 2012 at 02:42:03PM +0400, Dmitry A. Ashkadov wrote:\n> Hello!\n> \n> I can't understand how to fetch branches from external repository\n> for bare repository.\n\nWhat you probably want is a mirror (git clone --mirror). Unless you\ntell git that you want a mirror, it's going to assume that you want a\nbare repo to push your own changes up to it. Such a repo has no need\nto be kept up to date, so clone doesn't set up any fetch refspecs.\n\nStepping back, do you need to fetch those branches into the private\nrepo? If you still have access to the main repo and that's where the\nmain project development is happening, why not use upstream's repo to\nget those changes to your local repo (as in the one you use to work)?\nIt sounds like you're trying to replicate a centralised VCS'\nworkflow. Git works like a network and you can merge a branch from\nupstream if you need to and then push to the private repo.\n\n   cmn\n\n"},{"id":"182496","messageId":"4F103797.7060906@gmail.com","threadId":"29357","inReplyTo":"20120113134058.GB2850@centaur.lab.cmartin.tk","subject":"Re: fetch for bare repository","fromName":"Dmitry A. Ashkadov","fromEmail":"dmitry.ashkadov@gmail.com","sentAt":"2012-01-13T13:54:31Z","receivedAt":"2012-01-13T13:54:31Z","isPatch":false,"sender":{"key":"dmitry.ashkadov@gmail.com","avatar":null},"body":"13.01.2012 17:40, Carlos Martín Nieto пишет:\n> On Fri, Jan 13, 2012 at 02:42:03PM +0400, Dmitry A. Ashkadov wrote:\n>> Hello!\n>>\n>> I can't understand how to fetch branches from external repository\n>> for bare repository.\n> What you probably want is a mirror (git clone --mirror). Unless you\n> tell git that you want a mirror, it's going to assume that you want a\n> bare repo to push your own changes up to it. Such a repo has no need\n> to be kept up to date, so clone doesn't set up any fetch refspecs.\n\nI don't have access to an origin repository. So, I need bare repository \nand push changes up to it. So, I think the word \"mirror\" isn't \napplicable to private repository.\n\n> Stepping back, do you need to fetch those branches into the private\n> repo? If you still have access to the main repo and that's where the\n> main project development is happening, why not use upstream's repo to\n> get those changes to your local repo (as in the one you use to work)?\n> It sounds like you're trying to replicate a centralised VCS'\n> workflow. Git works like a network and you can merge a branch from\n> upstream if you need to and then push to the private repo.\n\nYes, I can add one more remote to my local repository, then fetch \nchanges from it and push it to private repository. But I thought that \nupdate private repository is the best way.\n\nThank you!\n"},{"id":"182499","messageId":"20120113151845.GD2850@centaur.lab.cmartin.tk","threadId":"29357","inReplyTo":"4F103797.7060906@gmail.com","subject":"Re: fetch for bare repository","fromName":"Carlos Martín Nieto","fromEmail":"cmn@elego.de","sentAt":"2012-01-13T15:18:45Z","receivedAt":"2012-01-13T15:18:45Z","isPatch":false,"sender":{"key":"cmn@elego.de","avatar":"https://avatars.githubusercontent.com/u/335443?v=4"},"body":"On Fri, Jan 13, 2012 at 05:54:31PM +0400, Dmitry A. Ashkadov wrote:\n> 13.01.2012 17:40, Carlos Martín Nieto пишет:\n> >On Fri, Jan 13, 2012 at 02:42:03PM +0400, Dmitry A. Ashkadov wrote:\n> >>Hello!\n> >>\n> >>I can't understand how to fetch branches from external repository\n> >>for bare repository.\n> >What you probably want is a mirror (git clone --mirror). Unless you\n> >tell git that you want a mirror, it's going to assume that you want a\n> >bare repo to push your own changes up to it. Such a repo has no need\n> >to be kept up to date, so clone doesn't set up any fetch refspecs.\n> \n> I don't have access to an origin repository. So, I need bare\n> repository and push changes up to it. So, I think the word \"mirror\"\n> isn't applicable to private repository.\n\nWhen you say access here, do you mean that you can't push to it? When\nI say access later on, it means being able to fetch from it.\nOtherwise I don't see how you could have cloned from it. If your\nprivate repository's braches to reflect what's upstream, I'd call that\na mirror.\n\n> \n> >Stepping back, do you need to fetch those branches into the private\n> >repo? If you still have access to the main repo and that's where the\n> >main project development is happening, why not use upstream's repo to\n> >get those changes to your local repo (as in the one you use to work)?\n> >It sounds like you're trying to replicate a centralised VCS'\n> >workflow. Git works like a network and you can merge a branch from\n> >upstream if you need to and then push to the private repo.\n> \n> Yes, I can add one more remote to my local repository, then fetch\n> changes from it and push it to private repository. But I thought\n> that update private repository is the best way.\n\nBest way to achieve what? If you want your private repo to reflect\nwhat's upstream, doing the inital clone with --mirror (or setting the\nremote.origin.fetch config variable to \"+refs/*:refs/*\", which is the\nmain difference) will let you run 'git fetch' on that repo and get the\nchanges.\n\nBut what I was asking was whether you actually need to bother with\nthat operation. If you need to merge or rebase from upstream, a push\nwill include those new changes, as they're now in your branch, so what\nadvantage do you get from copying those branches from upstream if\nthey're just the same?\n\n   cmn\n"}]}