Skip to content

escape branch name with leading # in example of no upstream set #311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
robstoll opened this issue Aug 12, 2019 · 5 comments
Closed

escape branch name with leading # in example of no upstream set #311

robstoll opened this issue Aug 12, 2019 · 5 comments

Comments

@robstoll
Copy link

say you have a branch named #42-my-lovely-branch and would like to push it but forgot to set the upstream branch. You get the following error message:

fatal: The current branch #42-my-lovely-branch has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin #42-my-lovely-branch

This cannot be copy & paste as #42-my-lovely-branch should be escaped with a backslash as follows:

    git push --set-upstream origin \#42-my-lovely-branch

As webtech mentioned here: gitgitgadget/gitgitgadget#112

Using # in the branch name is valid but will cause unexpected problems. If you are using windows cmd shell, # does not need to be escaped. On other shells, it needs to be escaped or quoted. Not sure git should need to figure out where it is running and determine if it needs to escape any characters in the branch name. If the # had not been the first character in the branch name the cut and paste may have worked with unexpected results.

@dscho
Copy link
Member

dscho commented Aug 12, 2019

Please note that most Git developers do not pay attention to this bug tracker, but only to bug reports via the Git mailing list.

@webstech
Copy link

Sorry for not redirecting you to the mailing list.

@dscho
Copy link
Member

dscho commented Oct 10, 2019

@robstoll did you send your bug report?

@robstoll
Copy link
Author

@dscho nope, I guess it's not important enough for me. So close the issue if you like

@dscho
Copy link
Member

dscho commented Oct 10, 2019

So close the issue if you like

I will close it for you. Next time, feel free to do that yourself, though.

@dscho dscho closed this as completed Oct 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants