'--set-upstream'是做什么的? [英] What does '--set-upstream' do?

查看:904
本文介绍了'--set-upstream'是做什么的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

- set-upstream 是做什么的?我试着通过阅读手册了解它,但我并没有完全理解它。



有人可以解释吗?

解决方案

  git branch --set-upstream< remote-branch> 

设置当前本地分支的默认远程分支。



任何将来的 git pull 命令(在检出当前本地分支的情况下),

将尝试从<



















$ b $ <避免必须明确执行 - set-upstream 的一种方法是使用简写标记 -u 一起 - 第一个 git push 如下


  git push -u origin local-branch 

这为上一次推/拉尝试设置上游关联自动。

有关更多详细信息,请查看此 关于上游分行和跟踪的详细说明





为避免混淆,最近版本的 git deprec吃了这个有点含糊不清的 - set-upstream 选项,以支持更详细的 - set-upstream-to 选项具有相同的语法和行为

$ g $ g $ git branch --set-upstream-to



What does --set-upstream do? I tried to understand it by reading the manual, but I didn't quite get it.

Can someone explain?

解决方案

git branch --set-upstream <remote-branch>

sets the default remote branch for the current local branch.

Any future git pull command (with the current local branch checked-out),
will attempt to bring in commits from the <remote-branch> into the current local branch.


One way to avoid having to explicitly do --set-upstream is
to use the shorthand flag -u along-with the very first git push as follows

git push -u origin local-branch

This sets the upstream association for any future push/pull attempts automatically.
For more details, checkout this detailed explanation about upstream branches and tracking.


To avoid confusion, recent versions of git deprecate this somewhat ambiguous --set-upstream option in favour of a more verbose --set-upstream-to option with identical syntax and behaviour

git branch --set-upstream-to <remote-branch>

这篇关于'--set-upstream'是做什么的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆