Git fetch origin vs git fetch --all

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36630490/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 11:56:40  来源:igfitidea点击:

Git fetch origin vs git fetch --all

gitgit-fetch

提问by Tony Scialo

What is the difference between the following git commands?

以下git命令有什么区别?

git fetch origin

and

git fetch --all

Running them from the command line looks like they do the same thing.

从命令行运行它们看起来它们做同样的事情。

回答by Matias Elorriaga

git fetch originfetch data only from origin, and git fetch --allfetch data from all remotes (originis one of them)

git fetch origin仅从 获取数据origin,并git fetch --all从所有遥控器获取数据(origin是其中之一)

回答by CodeWizard

git fetch --all

--all
Fetch all remotes.

--all
获取所有遥控器。

If you want to get all the data and on the same time also to remove the
deleted data add the --pruneflag

如果您想获取所有数据并同时删除
已删除的数据,请添加--prune标志

# Fetch all data, remove dangling objects and pack you repository
git fetch --all --prune=now

回答by isherwood

Your repository may have one remote point known by alias as 'origin', but you may also have other remotes configured. The latter command would fetch from them all.

您的存储库可能有一个名为“origin”的远程点,但您也可能配置了其他远程点。后一个命令将从它们全部获取。

More in the docs for fetch.

fetch 文档中的更多内容。