{"thread":{"id":"26365","subject":"Remote branchs -- how can I check them out?","startedAt":"2011-01-30T15:05:07Z","lastAt":"2011-01-31T02:51:11Z","messageCount":9,"participants":["João Paulo Melo de Sampaio","Konstantin Khomoutov","Jakub Narebski","Jonathan Nieder","Sverre Rabbelier","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"160049","messageId":"AANLkTin3Tfcf=WJHJdSA9TwhFXQfaMrnm5+YEWWjo=qj@mail.gmail.com","threadId":"26365","inReplyTo":null,"subject":"Remote branchs -- how can I check them out?","fromName":"João Paulo Melo de Sampaio","fromEmail":"jpmelos@gmail.com","sentAt":"2011-01-30T15:05:07Z","receivedAt":"2011-01-30T15:05:07Z","isPatch":false,"sender":{"key":"jpmelos@gmail.com","avatar":"https://gravatar.com/avatar/cf1eb89e5f7ab7a0f27eca3528460be048d790de7ca40b79212901161899255f?d=mp&s=160"},"body":"Hello, people.\n\nWhen I just cloned git using\n\n    git clone git://git.kernel.org/pub/scm/git/git.git\n\nand I type\n\n    git branch\n\nit shows me I have only the 'master' branch in my local repository\n\n    * master\n\nand when I type\n\n    git branch -a\n\nit shows that there's all these branches remotely\n\n    * master\n      remotes/origin/HEAD -> origin/master\n      remotes/origin/html\n      remotes/origin/maint\n      remotes/origin/man\n      remotes/origin/master\n      remotes/origin/next\n      remotes/origin/pu\n      remotes/origin/todo\n\nWhat do I have to do to be able to see what's in the 'maint', 'next'\nand 'todo' branches, for example?\n\nAnd by the way, what are those branches all about? Their names\nsuggests they are maintenance branches (where you keep backward\ncompatibility with an older version?), the next version of git (1.7.4\nversion?) and future features under implementation (the to-do list?).\n\nThank you for your time!\n\n-- \nJoão Paulo Melo de Sampaio\nComputer Engineering Student @ UFSCar\nWebsite: http://www.jpmelos.com\nTwitter: twitter.com/jpmelos (@jpmelos)\n"},{"id":"160052","messageId":"20110130160556.GI5713@localhost.localdomain","threadId":"26365","inReplyTo":"AANLkTin3Tfcf=WJHJdSA9TwhFXQfaMrnm5+YEWWjo=qj@mail.gmail.com","subject":"Re: Remote branchs -- how can I check them out?","fromName":"Konstantin Khomoutov","fromEmail":"flatworm@users.sourceforge.net","sentAt":"2011-01-30T16:05:57Z","receivedAt":"2011-01-30T16:05:57Z","isPatch":false,"sender":{"key":"flatworm@users.sourceforge.net","avatar":null},"body":"On Sun, Jan 30, 2011 at 01:05:07PM -0200, João Paulo Melo de Sampaio wrote:\n\n> When I just cloned git using\n> \n>     git clone git://git.kernel.org/pub/scm/git/git.git\n> \n> and I type\n> \n>     git branch\n> \n> it shows me I have only the 'master' branch in my local repository\n> \n>     * master\n> \n> and when I type\n> \n>     git branch -a\n> \n> it shows that there's all these branches remotely\n> \n>     * master\n>       remotes/origin/HEAD -> origin/master\n>       remotes/origin/html\n>       remotes/origin/maint\n>       remotes/origin/man\n>       remotes/origin/master\n>       remotes/origin/next\n>       remotes/origin/pu\n>       remotes/origin/todo\n> \n> What do I have to do to be able to see what's in the 'maint', 'next'\n> and 'todo' branches, for example?\nThese branches are local to your repository. They are \"remote\" in the\nsense you're not supposed to modify them directly.\nSo to inspect such a branch just use its full name (\"origin/next\" for\ninstance) when working with commands like git-log.\n\nSee [1], [2] for more info.\n\nAlso your question appears to be quite basic which hints at that you did\nnot read a good book on Git before using it.  So starting at [3] is\nrecommended -- it mentions a bunch of good books and manuals (some of\nwhich are available freely).\n\n1. http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#examining-remote-branches\n2. http://progit.org/book/ch3-5.html\n3. http://git-scm.com/documentation\n"},{"id":"160053","messageId":"m3lj229wpp.fsf@localhost.localdomain","threadId":"26365","inReplyTo":"AANLkTin3Tfcf=WJHJdSA9TwhFXQfaMrnm5+YEWWjo=qj@mail.gmail.com","subject":"Re: Remote branchs -- how can I check them out?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2011-01-30T16:35:19Z","receivedAt":"2011-01-30T16:35:19Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"João Paulo Melo de Sampaio <jpmelos@gmail.com> writes:\n\n> Hello, people.\n> \n> When I just cloned git using\n> \n>     git clone git://git.kernel.org/pub/scm/git/git.git\n> \n> and I type\n> \n>     git branch\n> \n> it shows me I have only the 'master' branch in my local repository\n> \n>     * master\n> \n> and when I type\n> \n>     git branch -a\n> \n> it shows that there's all these branches remotely\n> \n>     * master\n>       remotes/origin/HEAD -> origin/master\n>       remotes/origin/html\n>       remotes/origin/maint\n>       remotes/origin/man\n>       remotes/origin/master\n>       remotes/origin/next\n>       remotes/origin/pu\n>       remotes/origin/todo\n> \n> What do I have to do to be able to see what's in the 'maint', 'next'\n> and 'todo' branches, for example?\n\nThose are so called \"remote-tracking branches\", i.e. refs which follow\nbranches in some remote repository.  For example 'remotes/origin/master'\nfollows branch 'master' in remote 'origin'.  By follow I mean here that\non \"git fetch\" (also \"git pull\" and \"git remote update\") these \nremote-tracking branches would get updated to their value at remote.\n \nNow if you only want to check wah's in given branch (beside using\n\"git show <branch>\", \"git ls-tree <branch>\", \"git show <branch>:<file>\")\nyou can use e.g.\n\n  $ git checkout origin/next\n\nto check out _state_ of remotr-tracking branch origin/next, landing\nin so called \"detached HEAD\" state, or unnamed branch (no branch).\n\n\nIf you want to do some work based on given branch, you should create\nnew local branch based on remote-tracking one, e.g. via\n\n  $ git checkout -b --track next origin/next\n\nIIRC nowadays doiung simply\n\n  $ git checkout -t next\n\nshould DWIM to do the same.\n\n> And by the way, what are those branches all about? Their names\n> suggests they are maintenance branches (where you keep backward\n> compatibility with an older version?), the next version of git (1.7.4\n> version?) and future features under implementation (the to-do list?).\n\nIt is described in \"Notes from maintainer\" which you can find in git\nmailing list archives, in 'todo' branch of git repository, and on Git\nWiki.\n\n\n* 'master' - stable development, new major version is cut from it\n* 'next' - development branch, not everything that makes it here\n           would be in next version.  Rewound on new major version.\n* 'maint' - maintenance branch for last version, minor revisions are\n            cut from this; only bugfixes, no new development\n* 'pu' - proposed updates, merge of interesting topic branches,\n         very unstable, used to review proposed features\n\n* 'todo' - not wery well maintained TODO list, som scripts used e.g.\n           to send \"What's cooking...\" emails to git mailing list\n* 'html', 'man' - compiled documentation\n\ntodo, html and man are detached branches.\n\nHTH\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"160066","messageId":"20110130213258.GA10039@burratino","threadId":"26365","inReplyTo":"20110130160556.GI5713@localhost.localdomain","subject":"[RFC/PATCH 0/2] Re: Remote branchs -- how can I check them out?","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-30T21:32:58Z","receivedAt":"2011-01-30T21:32:58Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Konstantin Khomoutov wrote:\n\n> These branches are local to your repository. They are \"remote\" in the\n> sense you're not supposed to modify them directly.\n> So to inspect such a branch just use its full name (\"origin/next\" for\n> instance) when working with commands like git-log.\n>\n> See [1], [2] for more info.\n>\n> Also your question appears to be quite basic which hints at that you did\n> not read a good book on Git before using it.  So starting at [3] is\n> recommended -- it mentions a bunch of good books and manuals\n\nPointing to good references is a valuable thing --- thank you for that.\nBut I also want to point out that if you need to read a book before Git\nbecomes usable then we are doing something wrong. :)\n\nIn this example, perhaps the \"git branch\" manual page needs some\nimprovement?\n\nJonathan Nieder (2):\n  Documentation/branch: split description into subsections\n  Documentation/branch: briefly explain what a branch is\n\n Documentation/git-branch.txt |   62 +++++++++++++++++++++++++-----------------\n 1 files changed, 37 insertions(+), 25 deletions(-)\n"},{"id":"160067","messageId":"20110130213355.GB10039@burratino","threadId":"26365","inReplyTo":"20110130213258.GA10039@burratino","subject":"[PATCH 1/2] Documentation/branch: split description into subsections","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-30T21:33:55Z","receivedAt":"2011-01-30T21:33:55Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Add headings for each form of the \"git branch\" command.  Hopefully\nthis will make the description easier to read straight through without\ngetting lost and help technical writers to see what needs improvement\nin the treatment of each form.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n Documentation/git-branch.txt |   53 +++++++++++++++++++++++------------------\n 1 files changed, 30 insertions(+), 23 deletions(-)\n\ndiff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt\nindex 9106d38..d3eeb94 100644\n--- a/Documentation/git-branch.txt\n+++ b/Documentation/git-branch.txt\n@@ -18,25 +18,30 @@ SYNOPSIS\n DESCRIPTION\n -----------\n \n-With no arguments, existing branches are listed and the current branch will\n-be highlighted with an asterisk.  Option `-r` causes the remote-tracking\n-branches to be listed, and option `-a` shows both.\n+'git branch' [-r | -a]::\n+\tWith no arguments, existing branches are listed and the current\n+\tbranch will be highlighted with an asterisk.\n+\tOption `-r` causes the remote-tracking branches to be listed,\n+\tand option `-a` shows both.\n \n-With `--contains`, shows only the branches that contain the named commit\n-(in other words, the branches whose tip commits are descendants of the\n-named commit).  With `--merged`, only branches merged into the named\n-commit (i.e. the branches whose tip commits are reachable from the named\n-commit) will be listed.  With `--no-merged` only branches not merged into\n-the named commit will be listed.  If the <commit> argument is missing it\n-defaults to 'HEAD' (i.e. the tip of the current branch).\n-\n-The command's second form creates a new branch head named <branchname>\n-which points to the current 'HEAD', or <start-point> if given.\n+'git branch' (--contains | --merged | --no-merged) [<commit>]::\n+\tWith `--contains`, shows only the branches that contain the\n+\tnamed commit (in other words, the branches whose tip commits are\n+\tdescendants of the named commit).  With `--merged`, only\n+\tbranches merged into the named commit (i.e. the branches whose\n+\ttip commits are reachable from the named commit) will be listed.\n+\tWith `--no-merged` only branches not merged into the named\n+\tcommit will be listed.  If the <commit> argument is missing it\n+\tdefaults to 'HEAD' (i.e.  the tip of the current branch).\n \n+'git branch' <branchname> [<start-point>]::\n+\tThe command's second form creates a new branch head named <branchname>\n+\twhich points to the current 'HEAD', or <start-point> if given.\n++\n Note that this will create the new branch, but it will not switch the\n working tree to it; use \"git checkout <newbranch>\" to switch to the\n new branch.\n-\n++\n When a local branch is started off a remote-tracking branch, git sets up the\n branch so that 'git pull' will appropriately merge from\n the remote-tracking branch. This behavior may be changed via the global\n@@ -44,16 +49,18 @@ the remote-tracking branch. This behavior may be changed via the global\n overridden by using the `--track` and `--no-track` options, and\n changed later using `git branch --set-upstream`.\n \n-With a '-m' or '-M' option, <oldbranch> will be renamed to <newbranch>.\n-If <oldbranch> had a corresponding reflog, it is renamed to match\n-<newbranch>, and a reflog entry is created to remember the branch\n-renaming. If <newbranch> exists, -M must be used to force the rename\n-to happen.\n-\n-With a `-d` or `-D` option, `<branchname>` will be deleted.  You may\n-specify more than one branch for deletion.  If the branch currently\n-has a reflog then the reflog will also be deleted.\n+'git branch' (-m | -M) <oldbranch> <newbranch>::\n+\tWith a '-m' or '-M' option, <oldbranch> will be renamed to <newbranch>.\n+\tIf <oldbranch> had a corresponding reflog, it is renamed to match\n+\t<newbranch>, and a reflog entry is created to remember the branch\n+\trenaming. If <newbranch> exists, -M must be used to force the rename\n+\tto happen.\n \n+'git branch' (-d | -D) <branchname>::\n+\tWith a `-d` or `-D` option, `<branchname>` will be deleted.  You may\n+\tspecify more than one branch for deletion.  If the branch currently\n+\thas a reflog then the reflog will also be deleted.\n++\n Use -r together with -d to delete remote-tracking branches. Note, that it\n only makes sense to delete remote-tracking branches if they no longer exist\n in the remote repository or if 'git fetch' was configured not to fetch\n-- \n1.7.4.rc3\n"},{"id":"160068","messageId":"20110130213510.GC10039@burratino","threadId":"26365","inReplyTo":"20110130213258.GA10039@burratino","subject":"[PATCH 2/2] Documentation/branch: briefly explain what a branch is","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-01-30T21:35:10Z","receivedAt":"2011-01-30T21:35:10Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"The new reader might not know what git refs are, that history is a\ngraph, the distinction between local, remote-tracking, and remote\nbranches, or how to visualize what is going on.  After this change,\nthose things are still probably not evident but at least there is an\nearly reminder of some of it.\n\nAlso explain how to create a branch before explaining how to list\nthem.  Based roughly on the description of v0.99.1~53 (Add \"git\nbranch\" script, 2005-07-11).\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n Documentation/git-branch.txt |   35 ++++++++++++++++++++---------------\n 1 files changed, 20 insertions(+), 15 deletions(-)\n\ndiff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt\nindex d3eeb94..abad7ba 100644\n--- a/Documentation/git-branch.txt\n+++ b/Documentation/git-branch.txt\n@@ -18,6 +18,26 @@ SYNOPSIS\n DESCRIPTION\n -----------\n \n+Branches are references to commit objects, representing the tip of a\n+line of history.  The branch you are working on is referred to\n+by HEAD and the corresponding reference is updated each time\n+linkgit:git-commit[1] or linkgit:git-merge[1] makes a new commit.\n+\n+'git branch' <branchname> [<start-point>]::\n+\tCreates a new branch named `<branchname>`.\n+\tIf a starting point is specified, that will be where the branch\n+\tis created; otherwise, the new branch points to the `HEAD` commit.\n++\n+This will create a new branch, but it does not switch the working tree\n+to it.  Use \"git checkout <newbranch>\" to start working on the new branch.\n+\n+When a local branch is started off a remote-tracking branch, git sets up the\n+branch so that 'git pull' will appropriately merge from\n+the remote-tracking branch. This behavior may be changed via the global\n+`branch.autosetupmerge` configuration flag. That setting can be\n+overridden by using the `--track` and `--no-track` options, and\n+changed later using `git branch --set-upstream`.\n+\n 'git branch' [-r | -a]::\n \tWith no arguments, existing branches are listed and the current\n \tbranch will be highlighted with an asterisk.\n@@ -34,21 +54,6 @@ DESCRIPTION\n \tcommit will be listed.  If the <commit> argument is missing it\n \tdefaults to 'HEAD' (i.e.  the tip of the current branch).\n \n-'git branch' <branchname> [<start-point>]::\n-\tThe command's second form creates a new branch head named <branchname>\n-\twhich points to the current 'HEAD', or <start-point> if given.\n-+\n-Note that this will create the new branch, but it will not switch the\n-working tree to it; use \"git checkout <newbranch>\" to switch to the\n-new branch.\n-+\n-When a local branch is started off a remote-tracking branch, git sets up the\n-branch so that 'git pull' will appropriately merge from\n-the remote-tracking branch. This behavior may be changed via the global\n-`branch.autosetupmerge` configuration flag. That setting can be\n-overridden by using the `--track` and `--no-track` options, and\n-changed later using `git branch --set-upstream`.\n-\n 'git branch' (-m | -M) <oldbranch> <newbranch>::\n \tWith a '-m' or '-M' option, <oldbranch> will be renamed to <newbranch>.\n \tIf <oldbranch> had a corresponding reflog, it is renamed to match\n-- \n1.7.4.rc3\n"},{"id":"160077","messageId":"AANLkTin4uiCozHVjOcB8C=W6hpfEeeLK6uO9=cDEr6V3@mail.gmail.com","threadId":"26365","inReplyTo":"20110130213258.GA10039@burratino","subject":"Re: [RFC/PATCH 0/2] Re: Remote branchs -- how can I check them out?","fromName":"João Paulo Melo de Sampaio","fromEmail":"jpmelos@gmail.com","sentAt":"2011-01-31T00:35:35Z","receivedAt":"2011-01-31T00:35:35Z","isPatch":true,"sender":{"key":"jpmelos@gmail.com","avatar":"https://gravatar.com/avatar/cf1eb89e5f7ab7a0f27eca3528460be048d790de7ca40b79212901161899255f?d=mp&s=160"},"body":"Thank you for your help, Konstantin, Jakub and Jonathan!\n\nWhen I asked that, I've only read http://gitref.org/ so I guess I\ndidn't quite have a good grasp on the concepts. Now I've read some of\nPro Git and I'm understanding the concepts much better. Thank you for\npointing me those references, they'll be of good use!\n\n-- \nJoão Paulo Melo de Sampaio\nComputer Engineering Student @ UFSCar\nWebsite: http://www.jpmelos.com\nTwitter: twitter.com/jpmelos (@jpmelos)\n"},{"id":"160079","messageId":"AANLkTin0M=K2OS2SmFWBGj3nasVzQY91Uectz+B1vsCm@mail.gmail.com","threadId":"26365","inReplyTo":"20110130213355.GB10039@burratino","subject":"Re: [PATCH 1/2] Documentation/branch: split description into subsections","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2011-01-31T01:55:41Z","receivedAt":"2011-01-31T01:55:41Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\n2011/1/30 Jonathan Nieder <jrnieder@gmail.com>:\n> Add headings for each form of the \"git branch\" command.  Hopefully\n> this will make the description easier to read straight through without\n> getting lost and help technical writers to see what needs improvement\n> in the treatment of each form.\n\nI like it. Thought for the future: it would be nice if at a sprint or\nsuch we can read through and fix the rest of the documentation in a\nsimilar way.\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"160081","messageId":"7v4o8pbxb4.fsf@alter.siamese.dyndns.org","threadId":"26365","inReplyTo":"20110130213510.GC10039@burratino","subject":"Re: [PATCH 2/2] Documentation/branch: briefly explain what a branch is","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-01-31T02:51:11Z","receivedAt":"2011-01-31T02:51:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> The new reader might not know what git refs are, that history is a\n> graph, the distinction between local, remote-tracking, and remote\n> branches, or how to visualize what is going on.  After this change,\n> those things are still probably not evident but at least there is an\n> early reminder of some of it.\n>\n> Also explain how to create a branch before explaining how to list\n> them.  Based roughly on the description of v0.99.1~53 (Add \"git\n> branch\" script, 2005-07-11).\n>\n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n> ---\n>  Documentation/git-branch.txt |   35 ++++++++++++++++++++---------------\n>  1 files changed, 20 insertions(+), 15 deletions(-)\n\nI think these two are good readability changes.  Just a few nits though.\n\n> diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt\n> index d3eeb94..abad7ba 100644\n> --- a/Documentation/git-branch.txt\n> +++ b/Documentation/git-branch.txt\n> @@ -18,6 +18,26 @@ SYNOPSIS\n>  DESCRIPTION\n>  -----------\n>  \n> +Branches are references to commit objects, representing the tip of a\n> +line of history.  The branch you are working on is referred to\n> +by HEAD and the corresponding reference is updated each time\n> +linkgit:git-commit[1] or linkgit:git-merge[1] makes a new commit.\n\nI think \"makes a new commit\" is a somewhat misleading thing to say (think\n\"fast forward\" or \"rebase that makes more than one\").  The important point\nis \"advances your history\", isn't it?  How about...\n\n\t... reference is updated with various operations that advance your\n\thistory, e.g. linkgit:git-commit[1], linkgit:git-pull[1], etc.\n\nObviously we do not want to be exhausitve, so I tried to reword the above\nin a way that makes it explicit that we are not trying to be.\n\n> +'git branch' <branchname> [<start-point>]::\n> +\tCreates a new branch named `<branchname>`.\n> +\tIf a starting point is specified, that will be where the branch\n> +\tis created; otherwise, the new branch points to the `HEAD` commit.\n> ++\n> +This will create a new branch, but it does not switch the working tree\n> +to it.  Use \"git checkout <newbranch>\" to start working on the new branch.\n\nI do not think we define what _switch_ means to explain \"it does not\nswitch the working tree to it\" anywhere in the glossary.\n\nThe operation not only \"does not switcfh the working tree\", but also does\nnot do anything to HEAD.  You and I know that, but a new reader might not,\nand especially after hearing that \"branch ... is referred to by HEAD\",\nmight get a wrong impression that branch creation may do something to HEAD.\n\nPerhaps...\n\n\tThis only creates a new branch; you are still on the same branch\n\tyou were on before.  If you want to start working on the new\n\tbranch, say \"git checkout <newbranch>\".\n\nmight be less confusing (we might also want to hint \"checkout -b\").\n\nThanks.\n"}]}