如果有人帮我得到这个就太棒了。
假设我在 master 或一个名为 MyBranch 的分支中工作,我想将我刚刚提交的更改推送到一个新的 github 分支。当我做的时候
git push origin RemoteBranch
它会说类似的话
error: src refspec RemoteBranch does not match any.
error: failed to push some refs to 'git@github.com:bla/bla.git'
1) 为什么会这样?似乎将提交复制到远程分支的唯一方法是绝对确保它们的名称完全匹配。基本上我必须在本地执行一个 git branch RemoteBranch,然后我就可以很好地进行推送。
2) 如何查看远程分支的完整列表?
git branch -a
或
git branch -r
将只显示我在本地存储库中匹配的分支,而不是 github 上可用的所有分支。
谢谢!
最佳答案
如果你想看看 man
页面,你会发现如何。
您可以使用:git push <remote> <local-branch>:<remote-branch>
关于git - 本地和远程分支需要匹配 git push 的名称吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6510428/