{"thread":{"id":"16741","subject":"[usability bug] git branch -a does not disambiguate remote and local branches","startedAt":"2008-12-15T18:15:15Z","lastAt":"2008-12-16T06:26:34Z","messageCount":6,"participants":["Constantine Plotnikov","Johannes Schindelin","Lars Hjemli","Boyd Stephen Smith Jr.","Björn Steinbrink"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"97988","messageId":"85647ef50812151015t4d5bc2b8p4ea53a0e4ad25e64@mail.gmail.com","threadId":"16741","inReplyTo":null,"subject":"[usability bug] git branch -a does not disambiguate remote and local branches","fromName":"Constantine Plotnikov","fromEmail":"constantine.plotnikov@gmail.com","sentAt":"2008-12-15T18:15:15Z","receivedAt":"2008-12-15T18:15:15Z","isPatch":false,"sender":{"key":"constantine.plotnikov@gmail.com","avatar":null},"body":"Let's consider the following scenario:\n\nmkdir bare.git\nmkdir local\ncd bare.git\ngit --bare init\ncd ../local\ngit init\necho test > test.txt\ngit add test.txt\ngit commit -m test\ngit remote add origin `pwd`/../bare.git\ngit push --all\ngit checkout -b origin/master master\necho updated > test.txt\ngit add test.txt\ngit commit -m updated\n\nNote that that in this scenario, the user has created local branch in\nthe folder with the same name as a remote branch. While the supposed\nuser here is apparently shooting itself in the foot, the scenario is\nstill supported by git, and might happen as a result of more logical\ngit operations (like git fetch).\n\nAfter this scenario is executed, git branch -a will give the following output:\n  master\n* origin/master\n  origin/master\n\nNote that there is two origin/master entries, but it is not clear\nwhich is remote is and which is the local. I think that \"git branch\n-a\" should print unambiguous names, qualifying them if needed.\n\nConstantine\n"},{"id":"97990","messageId":"alpine.DEB.1.00.0812152005490.30769@pacific.mpi-cbg.de","threadId":"16741","inReplyTo":"85647ef50812151015t4d5bc2b8p4ea53a0e4ad25e64@mail.gmail.com","subject":"Re: [usability bug] git branch -a does not disambiguate remote and local branches","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-12-15T19:09:16Z","receivedAt":"2008-12-15T19:09:16Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 15 Dec 2008, Constantine Plotnikov wrote:\n\n> Let's consider the following scenario:\n> \n> mkdir bare.git\n> mkdir local\n> cd bare.git\n> git --bare init\n> cd ../local\n> git init\n> echo test > test.txt\n> git add test.txt\n> git commit -m test\n> git remote add origin `pwd`/../bare.git\n> git push --all\n> git checkout -b origin/master master\n> echo updated > test.txt\n> git add test.txt\n> git commit -m updated\n> \n> Note that that in this scenario, the user has created local branch in\n> the folder with the same name as a remote branch. While the supposed\n> user here is apparently shooting itself in the foot, the scenario is\n> still supported by git, and might happen as a result of more logical\n> git operations (like git fetch).\n\nIt is only half-supported, and Git will complain, saying that there are \nambiguous branches.\n\nIMHO it is better to be nice to the many users who do not try to shoot \nthemselves in the foot, by showing them the nice short names that will \nwork.\n\nThe others are warned when they use the ambiguous short names anyway.\n\nCiao,\nDscho\n"},{"id":"97991","messageId":"85647ef50812151115k41451d84jcfbdd9a187813e00@mail.gmail.com","threadId":"16741","inReplyTo":"alpine.DEB.1.00.0812152005490.30769@pacific.mpi-cbg.de","subject":"Re: [usability bug] git branch -a does not disambiguate remote and local branches","fromName":"Constantine Plotnikov","fromEmail":"constantine.plotnikov@gmail.com","sentAt":"2008-12-15T19:15:40Z","receivedAt":"2008-12-15T19:15:40Z","isPatch":false,"sender":{"key":"constantine.plotnikov@gmail.com","avatar":null},"body":"On Mon, Dec 15, 2008 at 10:09 PM, Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n> Hi,\n>\n> On Mon, 15 Dec 2008, Constantine Plotnikov wrote:\n>\n>> Let's consider the following scenario:\n>>\n>> mkdir bare.git\n>> mkdir local\n>> cd bare.git\n>> git --bare init\n>> cd ../local\n>> git init\n>> echo test > test.txt\n>> git add test.txt\n>> git commit -m test\n>> git remote add origin `pwd`/../bare.git\n>> git push --all\n>> git checkout -b origin/master master\n>> echo updated > test.txt\n>> git add test.txt\n>> git commit -m updated\n>>\n>> Note that that in this scenario, the user has created local branch in\n>> the folder with the same name as a remote branch. While the supposed\n>> user here is apparently shooting itself in the foot, the scenario is\n>> still supported by git, and might happen as a result of more logical\n>> git operations (like git fetch).\n>\n> It is only half-supported, and Git will complain, saying that there are\n> ambiguous branches.\n>\n> IMHO it is better to be nice to the many users who do not try to shoot\n> themselves in the foot, by showing them the nice short names that will\n> work.\n>\n> The others are warned when they use the ambiguous short names anyway.\n>\nIt is possible to be nice to to both categories showing shortest\ndisambiguated output like:\n\n  master\n* heads/origin/master\n  remotes/origin/master\n\nConstantine\n"},{"id":"97996","messageId":"200812151321.05421.bss03@volumehost.net","threadId":"16741","inReplyTo":"alpine.DEB.1.00.0812152005490.30769@pacific.mpi-cbg.de","subject":"Re: [usability bug] git branch -a does not disambiguate remote and local branches","fromName":"Boyd Stephen Smith Jr.","fromEmail":"bss03@volumehost.net","sentAt":"2008-12-15T19:21:00Z","receivedAt":"2008-12-15T19:21:00Z","isPatch":false,"sender":{"key":"bss03@volumehost.net","avatar":"https://gravatar.com/avatar/74fa10b37dfd44462a6a30c4d4e3bda26ab7991ddb0d8ab24b022714a8ecb918?d=mp&s=160"},"body":"On Monday 2008 December 15 13:09:16 Johannes Schindelin wrote:\n>IMHO it is better to be nice to the many users who do not try to shoot\n>themselves in the foot, by showing them the nice short names that will\n>work.\n\nIt should be possible to support both.  Short names when they are unique, \nlonger names when the short names are ambiguous.\n-- \nBoyd Stephen Smith Jr.                     ,= ,-_-. =. \nbss03@volumehost.net                      ((_/)o o(\\_))\nICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' \nhttp://iguanasuicide.org/                      \\_/     \n"},{"id":"97992","messageId":"8c5c35580812151124h5f9b8704l492a5a9a7eb48d1a@mail.gmail.com","threadId":"16741","inReplyTo":"85647ef50812151015t4d5bc2b8p4ea53a0e4ad25e64@mail.gmail.com","subject":"Re: [usability bug] git branch -a does not disambiguate remote and local branches","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2008-12-15T19:24:10Z","receivedAt":"2008-12-15T19:24:10Z","isPatch":false,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"On Mon, Dec 15, 2008 at 19:15, Constantine Plotnikov\n<constantine.plotnikov@gmail.com> wrote:\n> After this scenario is executed, git branch -a will give the following output:\n>  master\n> * origin/master\n>  origin/master\n>\n> Note that there is two origin/master entries, but it is not clear\n> which is remote is and which is the local.\n\nYou can use `git branch -a --color` to see the difference (issue `git\nconfig --global color.branch true` to use --color automatically).\n\n--\nlarsh\n"},{"id":"98044","messageId":"20081216062634.GB3684@atjola.homenet","threadId":"16741","inReplyTo":"85647ef50812151015t4d5bc2b8p4ea53a0e4ad25e64@mail.gmail.com","subject":"Re: [usability bug] git branch -a does not disambiguate remote and local branches","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2008-12-16T06:26:34Z","receivedAt":"2008-12-16T06:26:34Z","isPatch":false,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"On 2008.12.15 21:15:15 +0300, Constantine Plotnikov wrote:\n> After this scenario is executed, git branch -a will give the following output:\n>   master\n> * origin/master\n>   origin/master\n> \n> Note that there is two origin/master entries, but it is not clear\n> which is remote is and which is the local. I think that \"git branch\n> -a\" should print unambiguous names, qualifying them if needed.\n\nActually, it is clear. The one with the * is the local one. The remote\ntracking branch will never be marked as checked out, as you would get a\ndetached HEAD when you do \"git checkout remotes/origin/master\".\n\nWhen there are duplicate entries, you can be sure that you have a local\nbranch head and a remote tracking branch with the same shortname. And\nwhen one of them has been marked as checked out, you can be sure that it\nis the local one.\n\nBjörn\n"}]}