Closed
Description
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.
Metadata
Metadata
Assignees
Labels
No labels