local and remote branch need to match names for git push?

Viewed 2348

It'd be awesome if someone helped me get this.

Say I'm working in master or in a branch called MyBranch and I want to push the changes I just committed to a new github branch. When I do

git push origin RemoteBranch

it'll say something like

error: src refspec RemoteBranch does not match any.
error: failed to push some refs to 'git@github.com:bla/bla.git'

1) Why is that? It seems that only way to replicate a commit to a remote branch is to make absolutely sure that their names are a perfect match. Basically I have to locally perform a git branch RemoteBranch, and then I can do a push just fine.

2) How can I see the full list of remote branches?

git branch -a

or

git branch -r

will only show the branches whose match I have on my local repo as opposed to all of the branches available on github.

Thank you!

2 Answers
Related