git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Branch name support & character
@ 2017-09-07  3:27 夏大雨
  2017-09-07  5:31 ` Andrew Ardill
  0 siblings, 1 reply; 3+ messages in thread
From: 夏大雨 @ 2017-09-07  3:27 UTC (permalink / raw)
  To: git

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Branch name support & character
  2017-09-07  3:27 Branch name support & character 夏大雨
@ 2017-09-07  5:31 ` Andrew Ardill
  2017-09-08  1:18   ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Ardill @ 2017-09-07  5:31 UTC (permalink / raw)
  To: 夏大雨; +Cc: git@vger.kernel.org

Hi,

On 7 September 2017 at 13:27, 夏大雨 <xia.jason23@gmail.com> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Branch name support & character
  2017-09-07  5:31 ` Andrew Ardill
@ 2017-09-08  1:18   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2017-09-08  1:18 UTC (permalink / raw)
  To: Andrew Ardill; +Cc: 夏大雨, git@vger.kernel.org

Andrew Ardill <andrew.ardill@gmail.com> writes:

> 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'

Thanks for sanity-checking.  I was wondering if we have codepaths
that botch quoting (we shouldn't, and if there is, we should fix
it).

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

Good advice.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-08  1:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-07  3:27 Branch name support & character 夏大雨
2017-09-07  5:31 ` Andrew Ardill
2017-09-08  1:18   ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).