git ls remote和git ls remote origin之间的差异
运行git ls remote和git ls remote origin之间的差异,git,Git,运行git-ls-remote和git-ls-remote-origin有什么区别?此时会出现git ls remote输出原始存储库的每个分支和标记的SHA1 ID。由于原始回购默认标题为origin,因此这两个命令似乎产生相同的输出。这是对的吗?你是对的。因为您的遥控器被称为origin,所以这两个命令之间没有区别 要查看所有git remote,请运行git remote-v 另一方面,如果您的遥控器被调用为foobar,则git ls remote origin会给您带来以下错误: $
git-ls-remote
和git-ls-remote-origin
有什么区别?此时会出现git ls remote
输出原始存储库的每个分支和标记的SHA1 ID。由于原始回购默认标题为origin,因此这两个命令似乎产生相同的输出。这是对的吗?你是对的。因为您的遥控器被称为origin
,所以这两个命令之间没有区别
要查看所有git remote,请运行git remote-v
另一方面,如果您的遥控器被调用为foobar
,则git ls remote origin
会给您带来以下错误:
$ git ls-remote origin
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
虽然没有提到这一点,但此处的默认参数计算与以下参数相同:
未指定远程时,默认情况下将使用源站
远程,除非为当前分支配置了上游分支
这意味着,如果您定义了多个遥控器(例如,
origin
和second
),并且您在分支B
上,且branch.B.remote
设置为second
,则不带任何参数运行gitlsremote
,现在相当于运行gitlsremotesecond
。如果您在一个更典型的分支上,将branch.branch.remote
设置为origin
或根本不设置,则运行git ls remote
而不指定特定的远程相当于运行git ls remote origin,我认为可能会有所不同<代码>git ls远程源--头。dev
提供的输出与git ls remote--heads不同。开发人员。至少如果您没有本地分支dev
。在我看来,ls remote origin
似乎使用您的网络来检查远程,但是如果您使用--heads
标志,则ls remote
不会列出“dev”。