Branch name support & character

2 messages, 2 authors, 2017-09-07 · open the first message on its own page

Branch name support & character

From: 夏大雨 <hidden>
Date: 2017-09-07 03:27:44

I want to merge branch a to branch b so I rename branch b to a&b, but
when I push a&b to remote repo, '&' is took as & operator for shell,
and git push fails. So it would be better that branch name support &
character for me.

Re: Branch name support & character

From: Andrew Ardill <hidden>
Date: 2017-09-07 05:32:19

Hi,

On 7 September 2017 at 13:27, 夏大雨 [off-list ref] wrote:
I want to merge branch a to branch b so I rename branch b to a&b, but
when I push a&b to remote repo, '&' is took as & operator for shell,
and git push fails. So it would be better that branch name support &
character for me.
Have you tried quoting the branch name?

Using git checkout -b 'my&branch' works for me (single quotes around
the branch name).

Pushing to a local remote also works: git push --set-upstream
../git-test-2 'my&branch'

That being said, I would advise not using & in branch names,
specifically because it is a special character in shells.

Regards,

Andrew Ardill
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help