git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Branch name support & character

From
Andrew Ardill <andrew.ardill@gmail.com>
Date
Sep 7, 2017, 05:31 UTC
Message-ID
<CAH5451m9asxzaOEzQ2Jjk9Ly97GVnb7DV0uZS=96B=yHCYLWCw@mail.gmail.com>
In-Reply-To
<CA+zMtjmhrE54=ke6vVDGOcrbHkdPuE-Gf5cwQEp8LL2h+xen0g@mail.gmail.com>
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
Previous: 夏大雨Next: Junio C Hamano
Message 2 of 3 in “Branch name support & character”
  1. 夏大雨Sep 7, 2017
  2. Andrew ArdillSep 7, 2017
  3. Junio C HamanoSep 8, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.