[英]Why does git push all not require remote upstream branch
I created a new branch on my local repo and added a commit to it and then pushed it (along with changed on the master) to my remote repo using git push --all
, which works fine, ie it created a new remote branch with the same name as my local branch and pushed the changes there.我在我的本地存储库上创建了一个新分支并添加了一个提交,然后使用
git push --all
将它(连同主服务器上的更改一起) git push --all
送到我的远程存储库,它工作正常,即它创建了一个新的远程分支与我的本地分支同名并将更改推送到那里。
However, when using git push
whilst having the new branch checked out, it get the fatal: The current branch ... has no upstream branch.
但是,在签出新分支的同时使用
git push
时,会出现fatal: The current branch ... has no upstream branch.
error.错误。
Why does git push --all
assume a default branch and git push
doesn't?为什么
git push --all
假定默认分支而git push
没有?
The documentation for git push
indicates that --all
will assume defaults for all branches. git push
的文档表明--all
将假定所有分支的默认值。 https://git-scm.com/docs/git-push https://git-scm.com/docs/git-push
--all: Push all branches (ie refs under refs/heads/);
--all:推送所有分支(即refs/heads/下的refs); cannot be used with other <refspec>.
不能与其他 <refspec> 一起使用。
It's not the same for vanilla git push
. vanilla
git push
不一样。 You can, however, specify something like the following in your git configuration to make git push
default to the current branch.但是,您可以在 git 配置中指定类似以下内容,使
git push
默认为当前分支。
[push]
default = current
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.