{"thread":{"id":"46716","subject":"Branch name support & character","startedAt":"2017-09-07T03:27:44Z","lastAt":"2017-09-08T01:18:36Z","messageCount":3,"participants":["夏大雨","Andrew Ardill","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"327687","messageId":"CA+zMtjmhrE54=ke6vVDGOcrbHkdPuE-Gf5cwQEp8LL2h+xen0g@mail.gmail.com","threadId":"46716","inReplyTo":null,"subject":"Branch name support & character","fromName":"夏大雨","fromEmail":"xia.jason23@gmail.com","sentAt":"2017-09-07T03:27:37Z","receivedAt":"2017-09-07T03:27:44Z","isPatch":false,"sender":{"key":"xia.jason23@gmail.com","avatar":null},"body":"I want to merge branch a to branch b so I rename branch b to a&b, but\nwhen I push a&b to remote repo, '&' is took as & operator for shell,\nand git push fails. So it would be better that branch name support &\ncharacter for me.\n"},{"id":"327689","messageId":"CAH5451m9asxzaOEzQ2Jjk9Ly97GVnb7DV0uZS=96B=yHCYLWCw@mail.gmail.com","threadId":"46716","inReplyTo":"CA+zMtjmhrE54=ke6vVDGOcrbHkdPuE-Gf5cwQEp8LL2h+xen0g@mail.gmail.com","subject":"Re: Branch name support & character","fromName":"Andrew Ardill","fromEmail":"andrew.ardill@gmail.com","sentAt":"2017-09-07T05:31:33Z","receivedAt":"2017-09-07T05:32:19Z","isPatch":false,"sender":{"key":"andrew.ardill@gmail.com","avatar":"https://gravatar.com/avatar/da14cb7c091dd44dc6c63a4d3361b149acaf25226dc78eb4131a17b93d9b0993?d=mp&s=160"},"body":"Hi,\n\nOn 7 September 2017 at 13:27, 夏大雨 <xia.jason23@gmail.com> wrote:\n> I want to merge branch a to branch b so I rename branch b to a&b, but\n> when I push a&b to remote repo, '&' is took as & operator for shell,\n> and git push fails. So it would be better that branch name support &\n> character for me.\n\nHave you tried quoting the branch name?\n\nUsing git checkout -b 'my&branch' works for me (single quotes around\nthe branch name).\n\nPushing to a local remote also works: git push --set-upstream\n../git-test-2 'my&branch'\n\nThat being said, I would advise not using & in branch names,\nspecifically because it is a special character in shells.\n\nRegards,\n\nAndrew Ardill\n"},{"id":"327738","messageId":"xmqqk21a0yzi.fsf@gitster.mtv.corp.google.com","threadId":"46716","inReplyTo":"CAH5451m9asxzaOEzQ2Jjk9Ly97GVnb7DV0uZS=96B=yHCYLWCw@mail.gmail.com","subject":"Re: Branch name support & character","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-09-08T01:18:25Z","receivedAt":"2017-09-08T01:18:36Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andrew Ardill <andrew.ardill@gmail.com> writes:\n\n> Using git checkout -b 'my&branch' works for me (single quotes around\n> the branch name).\n>\n> Pushing to a local remote also works: git push --set-upstream\n> ../git-test-2 'my&branch'\n\nThanks for sanity-checking.  I was wondering if we have codepaths\nthat botch quoting (we shouldn't, and if there is, we should fix\nit).\n\n>\n> That being said, I would advise not using & in branch names,\n> specifically because it is a special character in shells.\n\nGood advice.\n\n"}]}