- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
尽管我尽了最大努力去理解它,但我显然不擅长使用 git。
来自 kernel.org对于 git push
:
-u
--set-upstream
For every branch that is up to date or successfully pushed, add upstream (tracking) reference, used by argument-less git-pull(1) and other commands. For more information, see
branch.<name>.merge
in git-config(1).
这是 branch.<name>.merge
来自 git config
:
branch.<name>.merge
Defines, together with
branch.<name>.remote
, the upstream branch for the given branch. It tells git fetch/git pull which branch to merge and can also affect git push (see push.default). When in branch<name>
, it tells git fetch the default refspec to be marked for merging in FETCH_HEAD. The value is handled like the remote part of a refspec, and must match a ref which is fetched from the remote given by"branch.<name>.remote"
. The merge information is used by git pull (which at first calls git fetch) to lookup the default branch for merging. Without this option, git pull defaults to merge the first refspec fetched. Specify multiple values to get an octopus merge. If you wish to setup git pull so that it merges into<name>
from another branch in the local repository, you can pointbranch.<name>.merge
to the desired branch, and use the special setting . (a period) forbranch.<name>.remote
.
我成功地使用 github 设置了一个远程存储库,并成功地将我的第一个提交推送到它:
git push -u origin master
然后,我无意中成功地将我的第二次提交推送到我的远程存储库,使用:
git commit -m '[...]'
但是,错误地认为我必须再次推送到 origin
来自 master
,我跑了:
# note: no -u
git push origin master
那是做什么的?好像一点作用都没有。我“撤消”了吗git push -u origin master
?
最佳答案
关键是“无参数 git-pull”。当你做 git pull
从分支,不指定源远程或分支,git 查看 branch.<name>.merge
设置以知道从哪里 pull 。 git push -u
为您推送的分支设置此信息。
要查看差异,让我们使用一个新的空分支:
$ git checkout -b test
首先,我们在没有 -u
的情况下推送:
$ git push origin test
$ git pull
You asked me to pull without telling me which branch you
want to merge with, and 'branch.test.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.
If you often merge with the same branch, you may want to
use something like the following in your configuration file:
[branch "test"]
remote = <nickname>
merge = <remote-ref>
[remote "<nickname>"]
url = <url>
fetch = <refspec>
See git-config(1) for details.
现在如果我们添加 -u
:
$ git push -u origin test
Branch test set up to track remote branch test from origin.
Everything up-to-date
$ git pull
Already up-to-date.
请注意,已设置跟踪信息,以便 git pull
无需指定远程或分支即可按预期工作。
更新:奖励提示:
git pull
此设置还会影响 git push
的默认行为.如果你养成了使用 -u
的习惯要捕获您打算跟踪的远程分支,我建议设置您的 push.default
配置值为 upstream
.git push -u <remote> HEAD
会将当前分支推送到 <remote>
上的同名分支(并设置跟踪,以便您可以在之后执行 git push
)。关于git - "u"到底做了什么? "git push -u origin master"与 "git push origin master",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23691963/
我想显示阿拉伯文字,但字符 المملك 显示。 例如,在 المملكة العربية السعودية 上显示单词 المملك٩ ا
我的应用程序正在 java + MSSQL 和 MySQL 上运行。下面的查询适用于 MSSQL,但不适用于 MySql。在 mysql 中,当我编写如下查询时,它给出了错误的结果 查询 select
根据 is_destructible 的定义( http://eel.is/c++draft/meta.unary.prop#lib:is_destructible ), is_destructib
我有一个数据库表,其中有一列我对波斯字母进行了分类,以便稍后使用 MySQL WHERE 选择。一切都适用于所有字母,但我在选择在数据库中存储为 (Ù†) 的字母 (?) 和存储为 (Ú†) 的 (?
我知道像这样的可选链接: someOptional?.someProperty 基本上是 someOptional.map { $0.someProperty } 但是,我发现同时做这两件事是不可能的
u-boot配置文件中的以下配置我看不懂 CONFIG_SYS_EXTRA_OPTIONS="SYS_SDRAM_SIZE=0x20000000" 好像在 u-boot 代码中设置 DRAM 大小。但
我对以下两个方法声明感到困惑: private T funWorks(T child, U parent) { // No compilation errors }
给定如下 API: class Bar { ... } class Foo extends Bar { ... } 在 Java 的 Optional 类型中,我们可以说: Optional fooO
我有一个文件,每行有两个字符: $ cat roman Ⅱ Ⅲ nut 当我用 sort -u 对这个文件进行排序时,只显示一行: $ sort -u roman Ⅱ Ⅱ是代码点U+2161,Ⅲ是代码
我正在尝试将 C 数组分配给 C++ std::array。 我该如何做到这一点,最干净的方式并且不制作不需要的拷贝等? 什么时候做 int X[8]; std::array Y = X; 我得到一个
我有以下案例类: case class [Q Length[T] 但是,我收到一条错误消息,说 需要三个参数,而我只给出了两个。我希望它像这样工作: type Area[T] = [Length[T
它是 well documented那个[T; n]可以强制到[T] .下面的代码也是well-formed : fn test(){ let _a: &[i32] = &[1, 2, 3];
我正在尝试使用 tweepy 在 Tkinter 窗口上显示我的 Twitter 时间线。这是代码 import tweepy import tkinter consumer_key = 'xxxxx
我正在使用以下包含 letter ü 的文本片段: test für fur test 代码如下: import re for m in re.finditer(r, line, re.IGNOREC
我对 USQL 很陌生,想知道如何在 select 语句中将“日期时间”转换为“日期”。另外,我如何摆脱毫秒和上午/下午?我真的很感激这方面的任何帮助。谢谢你们。 最佳答案 下面是有效的代码。注意括号
在 U-SQL 自定义代码(代码隐藏或程序集)中可以调用外部服务,例如bing搜索或 map 。 谢谢, 纳西尔 最佳答案 由于以下原因,目前不支持此功能: 想象一下,您编写了一个 UDF 或 UDO
我想 ping 出多个以太网端口。 u-boot 仅支持单个以太网端口是否存在固有限制? 最佳答案 Can u-boot support more than one ethernet port? 是的
我最近开始学习Prolog,但无法解决如何将三个列表合并的问题。 我能够合并两个列表: %element element(X,[X|_]). element(X,[_|Y]):-
我们使用 Beaglebone 黑色定制板。我编辑了一个链接器脚本文件以添加内存部分以在其中记录一些信息: . = ALIGN(4); .logging : { _log_begin
我们使用 Beaglebone 黑色定制板。我编辑了一个链接器脚本文件以添加内存部分以在其中记录一些信息: . = ALIGN(4); .logging : { _log_begin
我是一名优秀的程序员,十分优秀!