“git推送”上缺少参数有什么意义?命令?
以下命令的意义是什么:
git Push
git Push origin
git Push origin master
What is the significance of the following commands:
git push
git push origin
git push origin master
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该命令将一些内容从本地存储库推送到远程存储库。
可以是配置的远程名称或远程 git 存储库的完整 URL。
的一般形式是可选的+
后跟:
,其中< ;src>
是本地分支、标记或提交 ID 的名称,
是要推送到的远程分支或标记的名称。如果省略:
,则相当于:
。这意味着 git push origin master 相当于 git Push origin master:master 。+
用于尝试非快进推送。如果您不提供远程存储库(第三个参数),则将使用当前分支(如果有)配置的远程存储库,如果没有,则使用
origin
。如果您不提供要推送的引用规范(第四个参数),那么如果有一个为正在推送的远程配置的推送引用规范(配置变量:
remote..push
),那么使用,否则行为取决于配置变量push.default
的设置。默认值为
matching
,它会推送与要推送到的远程设备上的远程分支(按名称)匹配的所有本地分支。push.default
的其他选项包括nothing
(不执行任何操作)、upstream
或tracking
推送当前分支到其配置的上游分支和当前分支,将当前分支推送到远程上的同名分支。This command pushes some things from the local repository to a remote repository.
<remote>
can be the name of a configured remote or a full URL to a remote git repository.<refspec>
, in its general form is an optional+
followed by<src>:<dst>
where<src>
is the name of a local branch, tag or commit id and<dst>
is the name of a remote branch or tag to push to. If:<dst>
is omitted, it is equivalent to<src>:<src>
. This means thatgit push origin master
is equivalent togit push origin master:master
. The+
is used to attempt non fast-forward pushes.If you don't supply a remote repository (third parameter), then the configured remote for the current branch (if any) will be used, or
origin
if none.If you don't supply a refspec to push (the fourth parameter) then if there is a configured push refspec for the remote being pushed (config variable:
remote.<remotename>.push
) then that is used, otherwise the behaviour depends on the setting of the config variablepush.default
.The default is
matching
which pushes all local branches which match (by name) a remote branch on the remote being pushed to.Other options for
push.default
arenothing
(which does nothing),upstream
ortracking
which pushes the current branch to its configured upstream branch andcurrent
which pushes the current branch to an identically named branch on the remote.