git push -u是什么意思? [英] What does git push -u mean?

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

问题描述

我有两个不同版本的git。
在1.6.2版本中, git push 没有 -u 选项。它只出现在1.7.x版本中。

I have two different versions of git. In the 1.6.2 version, git push does not have the -u option. It only appears in the 1.7.x version.

从文档中, -u 与变量有关

branch.<name>.merge

位于 git config 中。这个变量描述如下:

in git config. This variable is described below:

Defines, together with branch.<name>.remote, the upstream branch 
for the given branch. It tells git fetch/git pull which branch to merge.

什么是上游分支?

What is an upstream branch ?

推荐答案

上游指的是其他人将从其中撤回的主要回购,例如你的GitHub回购。 -u选项自动为您设置上游,将您的repo链接到中央服务器。这样,未来,Git会知道你想推到哪里以及你想从哪里拉取,所以你可以使用 git pull git push 不带参数。一点点,这篇文章解释并演示了这个概念。

"Upstream" would refer to the main repo that other people will be pulling from, e.g. your GitHub repo. The -u option automatically sets that upstream for you, linking your repo to a central one. That way, in the future, Git "knows" where you want to push to and where you want to pull from, so you can use git pull or git push without arguments. A little bit down, this article explains and demonstrates this concept.

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

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