我可以将分支推送到远程:
git push --set-upstream origin 293-error-pages
Run Code Online (Sandbox Code Playgroud)
通过明确指定当前分支,我可以在不设置上游的情况下推送分支:
git push origin 293-error-pages
Run Code Online (Sandbox Code Playgroud)
如何将当前分支推送到远程?(并且没有明确指定其名称)
git push origin
Run Code Online (Sandbox Code Playgroud)
告诉我:
fatal: The current branch 293-error-pages has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin 293-error-pages
Run Code Online (Sandbox Code Playgroud)
要将当前分支推送到远程,您应该设置/配置push.default为“当前”
git config --global push.default current
Run Code Online (Sandbox Code Playgroud)
push.default
如果没有明确给出refspec,定义 git push 应该采取的行动。current - 推送当前分支以更新接收端的同名分支。适用于中央和非中央工作流。