我在本地建了一个分支cocoli,开发完之后,提交代码:(代码1)
git add .
git commit -m '注释'
git push
意思是:当前分支没有与远程分支关联。因此导致了提交代码失败:
$ git push
fatal: The current branch wangxiao has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin feat-wenke
解决方案:
- 直接 git push origin feat-wenke 推向制定的分支,最强暴的方法
- 关联远程分支,代码如下:
git push --set-upstream origin feat-wenke