{"thread":{"id":"26486","subject":"remote branches","startedAt":"2011-02-13T07:42:37Z","lastAt":"2011-02-16T18:00:20Z","messageCount":8,"participants":["Matthieu Imbert","Ævar Arnfjörð Bjarmason","Andreas Schwab","Björn Steinbrink","Junio C Hamano","Christian Jaeger"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"160977","messageId":"4D578B6D.9090803@inria.fr","threadId":"26486","inReplyTo":null,"subject":"remote branches","fromName":"Matthieu Imbert","fromEmail":"matthieu.imbert@inria.fr","sentAt":"2011-02-13T07:42:37Z","receivedAt":"2011-02-13T07:42:37Z","isPatch":false,"sender":{"key":"matthieu.imbert@inria.fr","avatar":null},"body":"hi.\n\nI have troubles (probably due to my misunderstanding) with git remote \ntracking branches. It seems to me that reality and documentation are \ndifferent:\n\n- i clone the linux git repo:\n\n$ git clone \ngit://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git \nlinux-2.6.git\n\n- then i add a remote tracking branch:\n\n$ git remote add --tags drm-intel \ngit://git.kernel.org/pub/scm/linux/kernel/git/ickle/drm-intel.git\n\n- Then i do git fetch or git fetch drm-intel, but nothing happens, and \ngit branch -r still only show me origin/HEAD and origin/master, no \ndrm-intel branches, though these branches do exist since i can see them \nwith git remote -v show drm-intel\n\nwhat am i doing wrong here, any idea?\ncheers,\n\n-- \nMatthieu\n"},{"id":"160983","messageId":"AANLkTi=WPAYXg1NCyO+XDw8Jk5v=QBH3nM78CEHytuVQ@mail.gmail.com","threadId":"26486","inReplyTo":"4D578B6D.9090803@inria.fr","subject":"Re: remote branches","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2011-02-13T09:17:48Z","receivedAt":"2011-02-13T09:17:48Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Sun, Feb 13, 2011 at 08:42, Matthieu Imbert <matthieu.imbert@inria.fr> wrote:\n\n> $ git clone\n> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git\n> linux-2.6.git\n>\n> - then i add a remote tracking branch:\n>\n> $ git remote add --tags drm-intel\n> git://git.kernel.org/pub/scm/linux/kernel/git/ickle/drm-intel.git\n\nYou're adding a remote repository and tracking branches and tags from\nit.\n\n> - Then i do git fetch or git fetch drm-intel, but nothing happens, and git\n> branch -r still only show me origin/HEAD and origin/master, no drm-intel\n> branches, though these branches do exist since i can see them with git\n> remote -v show drm-intel\n\nYou didn't add any remote tracking *branch*, you added a remote and\ngave it the name \"drm-intel\". You could just as well do:\n\n    git remote add --tags some-random-name\ngit://git.kernel.org/pub/scm/linux/kernel/git/ickle/drm-intel.git\n\nAlso because you specified --tags you're only getting the tags on \"git\nfetch\", if you don't do that then:\n\n    $ git fetch some-random-name\n    remote: Counting objects: 567, done.\n    remote: Compressing objects: 100% (377/377), done.\n    remote: Total 488 (delta 371), reused 146 (delta 111)\n    Receiving objects: 100% (488/488), 91.42 KiB, done.\n    Resolving deltas: 100% (371/371), completed with 53 local objects.\n    From git://git.kernel.org/pub/scm/linux/kernel/git/ickle/drm-intel\n     * [new branch]      drm-intel-fixes -> some-random-name/drm-intel-fixes\n     * [new branch]      drm-intel-fixes-2 -> some-random-name/drm-intel-fixes-2\n     * [new branch]      drm-intel-next -> some-random-name/drm-intel-next\n     * [new branch]      drm-intel-staging -> some-random-name/drm-intel-staging\n\nWhich allows you to do:\n\n    $ git checkout --track some-random-name/drm-intel-fixes\n    Branch drm-intel-fixes set up to track remote branch\ndrm-intel-fixes from some-random-name.\n    Switched to a new branch 'drm-intel-fixes'\n"},{"id":"160989","messageId":"4D57AD4F.3030109@inria.fr","threadId":"26486","inReplyTo":"AANLkTi=WPAYXg1NCyO+XDw8Jk5v=QBH3nM78CEHytuVQ@mail.gmail.com","subject":"Re: remote branches","fromName":"Matthieu Imbert","fromEmail":"matthieu.imbert@inria.fr","sentAt":"2011-02-13T10:07:11Z","receivedAt":"2011-02-13T10:07:11Z","isPatch":false,"sender":{"key":"matthieu.imbert@inria.fr","avatar":null},"body":"On 02/13/2011 10:17 AM, Ævar Arnfjörð Bjarmason wrote:\n> On Sun, Feb 13, 2011 at 08:42, Matthieu Imbert<matthieu.imbert@inria.fr>  wrote:\n>\n>> $ git clone\n>> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git\n>> linux-2.6.git\n>>\n>> - then i add a remote tracking branch:\n>>\n>> $ git remote add --tags drm-intel\n>> git://git.kernel.org/pub/scm/linux/kernel/git/ickle/drm-intel.git\n>\n> You're adding a remote repository and tracking branches and tags from\n> it.\n>\n>> - Then i do git fetch or git fetch drm-intel, but nothing happens, and git\n>> branch -r still only show me origin/HEAD and origin/master, no drm-intel\n>> branches, though these branches do exist since i can see them with git\n>> remote -v show drm-intel\n>\n> You didn't add any remote tracking *branch*, you added a remote and\n> gave it the name \"drm-intel\". You could just as well do:\n>\n>      git remote add --tags some-random-name\n> git://git.kernel.org/pub/scm/linux/kernel/git/ickle/drm-intel.git\n>\n> Also because you specified --tags you're only getting the tags on \"git\n> fetch\", if you don't do that then:\n>\n>      $ git fetch some-random-name\n>      remote: Counting objects: 567, done.\n>      remote: Compressing objects: 100% (377/377), done.\n>      remote: Total 488 (delta 371), reused 146 (delta 111)\n>      Receiving objects: 100% (488/488), 91.42 KiB, done.\n>      Resolving deltas: 100% (371/371), completed with 53 local objects.\n>      From git://git.kernel.org/pub/scm/linux/kernel/git/ickle/drm-intel\n>       * [new branch]      drm-intel-fixes ->  some-random-name/drm-intel-fixes\n>       * [new branch]      drm-intel-fixes-2 ->  some-random-name/drm-intel-fixes-2\n>       * [new branch]      drm-intel-next ->  some-random-name/drm-intel-next\n>       * [new branch]      drm-intel-staging ->  some-random-name/drm-intel-staging\n>\n> Which allows you to do:\n>\n>      $ git checkout --track some-random-name/drm-intel-fixes\n>      Branch drm-intel-fixes set up to track remote branch\n> drm-intel-fixes from some-random-name.\n>      Switched to a new branch 'drm-intel-fixes'\n\nYou're right, the faulty option was --tags. Trying without this i was \nable to fetch.\nThanks,\n\n-- \nMatthieu\n"},{"id":"160990","messageId":"m2wrl49rhg.fsf@whitebox.home","threadId":"26486","inReplyTo":"AANLkTi=WPAYXg1NCyO+XDw8Jk5v=QBH3nM78CEHytuVQ@mail.gmail.com","subject":"Re: remote branches","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2011-02-13T10:08:27Z","receivedAt":"2011-02-13T10:08:27Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n> Also because you specified --tags you're only getting the tags on \"git\n> fetch\",\n\nThat's not what git-remote(1) says:\n\n           With --tags option, git fetch <name> imports every tag from the\n           remote repository.\n\nThere is no \"only\" in this sentence.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"160991","messageId":"4D57AEAE.9090406@inria.fr","threadId":"26486","inReplyTo":"m2wrl49rhg.fsf@whitebox.home","subject":"Re: remote branches","fromName":"Matthieu Imbert","fromEmail":"matthieu.imbert@inria.fr","sentAt":"2011-02-13T10:13:02Z","receivedAt":"2011-02-13T10:13:02Z","isPatch":false,"sender":{"key":"matthieu.imbert@inria.fr","avatar":null},"body":"On 02/13/2011 11:08 AM, Andreas Schwab wrote:\n> Ævar Arnfjörð Bjarmason<avarab@gmail.com>  writes:\n>\n>> Also because you specified --tags you're only getting the tags on \"git\n>> fetch\",\n>\n> That's not what git-remote(1) says:\n>\n>             With --tags option, git fetch<name>  imports every tag from the\n>             remote repository.\n>\n> There is no \"only\" in this sentence.\n>\n> Andreas.\n\nI agree, this is what misleaded me. Perhaps the doc should be updated?\n\n-- \nMatthieu\n"},{"id":"160996","messageId":"20110213103156.GB4202@atjola.homenet","threadId":"26486","inReplyTo":"AANLkTi=WPAYXg1NCyO+XDw8Jk5v=QBH3nM78CEHytuVQ@mail.gmail.com","subject":"Re: remote branches","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2011-02-13T10:31:56Z","receivedAt":"2011-02-13T10:31:56Z","isPatch":false,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"On 2011.02.13 10:17:48 +0100, Ævar Arnfjörð Bjarmason wrote:\n> Also because you specified --tags you're only getting the tags on \"git\n> fetch\"\n\nThat looks like a bug to me.\n\nIt's ok for fetch to treat --tags like a refspec and to have it override\nthe defaults from the config when the user manually specifies it on the\ncommand line. But when it is part of the default configuration it should\nadd to remote.<name>.fetch, not override it.\n\nIOW with this configuration:\nremote.foo.url = git://host/repo.git\nremote.foo.fetch = +refs/heads/*:refs/remotes/foo/*\nremote.foo.tagopt = --tags\n\n\"git fetch foo\" acts like:\n\ngit fetch --tags git://host/repo.git\n\ninstead of\n\ngit fetch --tags git://host/repo.git +refs/heads/*:refs/remotes/foo/*\n\nAnd I'd argue that the latter makes a lot more sense. Also because the\nformer could always be achieved by dropping the remote.foo.fetch config\nsetting.\n\nThoughts?\n\nBjörn\n"},{"id":"161026","messageId":"7vmxlzuouj.fsf@alter.siamese.dyndns.org","threadId":"26486","inReplyTo":"20110213103156.GB4202@atjola.homenet","subject":"Re: remote branches","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-02-14T06:12:04Z","receivedAt":"2011-02-14T06:12:04Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Björn Steinbrink <B.Steinbrink@gmx.de> writes:\n\n> It's ok for fetch to treat --tags like a refspec and to have it override\n> the defaults from the config when the user manually specifies it on the\n> command line. But when it is part of the default configuration it should\n> add to remote.<name>.fetch, not override it.\n>\n> IOW with this configuration:\n> remote.foo.url = git://host/repo.git\n> remote.foo.fetch = +refs/heads/*:refs/remotes/foo/*\n> remote.foo.tagopt = --tags\n>\n> \"git fetch foo\" acts like:\n>\n> git fetch --tags git://host/repo.git\n>\n> instead of\n>\n> git fetch --tags git://host/repo.git +refs/heads/*:refs/remotes/foo/*\n\nI would agree that the behaviour of tagopt acting exactly as if the\noptions were given from the command line is an ungly hack, not an intended\nbehaviour.  Interested in coming up with a proposed approach for a fix?\n\nI would say --tags from the command line probably outlived its original\npurpose; back when we didn't have the reliable automatic following,\nsometimes people needed to say \"fetch --tags\" to complete the set of tags.\nThe description in config.txt for --tags also cites another purpose,\nnamely, to fetch tags otherwise totally unrelated to the branches you are\nfollowing, but in reality there is no sensible use case to require such a\nfeature.  Yes, you may have many unrelated lines of development with\nseparate set of tags on them, but then --tags to fetch _all_ tags from\nall of these unrelated lines of development is a too coarse-grained tool\nto be useful.\n\nNote that \"fetch --tags\" without following any of the branches _is_ a\nsensible setting for a rather common workflow.\n\nFor every active developer who will have his own private changes in the\nrepository, there would be 100 passive followers who would fetch the\nbranches of the project and build the bleeding edge (i.e. nightly\nbuilders) and these two classes of people would benefit from having\n\"refs/heads/*:refs/remotes/origin/*\" refspec.  And for each of these\npeople, there would be 100 people who would be interested only in tagged\nreleases.  They of course could download tarballs, but they can instead\nsay \"fetch --tags\", check out the latest tagged release and use it.\n"},{"id":"161317","messageId":"AANLkTi=FYvgY-N2krTh3pdocJRXXVA5jqtBKgXj6OVEw@mail.gmail.com","threadId":"26486","inReplyTo":"7vmxlzuouj.fsf@alter.siamese.dyndns.org","subject":"Re: remote branches","fromName":"Christian Jaeger","fromEmail":"chrjae@gmail.com","sentAt":"2011-02-16T18:00:20Z","receivedAt":"2011-02-16T18:00:20Z","isPatch":false,"sender":{"key":"chrjae@gmail.com","avatar":null},"body":"2011/2/14 Junio C Hamano <gitster@pobox.com>:\n> The description in config.txt for --tags also cites another purpose,\n> namely, to fetch tags otherwise totally unrelated to the branches you are\n> following, but in reality there is no sensible use case to require such a\n> feature.  Yes, you may have many unrelated lines of development with\n> separate set of tags on them, but then --tags to fetch _all_ tags from\n> all of these unrelated lines of development is a too coarse-grained tool\n> to be useful.\n>\n\nFWIW, here's my use case: I'm doing development on two separate\ncomputers, and I'm synchronizing my work between those by fetching\nfrom each other computer directly (not pushing through a common repo),\ni.e. \"git remote add other b:/home/me/foo/.git\" in ~/foo/.git on\ncomputer a and \"git remote add other a:/home/me/foo/.git\" on computer\nb. Now I often drop partial work, rebase it etc., and make tags before\nthe dropping, and sometimes I want to revisit those tagged (but not\notherwise reachable) commits, and for that I want them to be available\non both computers. I too searched the config docs, tried \"tagopts =\n--tags\" and then wondered why it wouldn't sync my branches anymore,\nthen moved to \"fetch = +refs/tags/*:refs/tags/*\".\n\nChristian.\n"}]}