Git fetch origin 与 git fetch --all

Git fetch origin vs git fetch --all

以下 git 命令有什么区别?

git fetch origin

git fetch --all

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

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

the docs for fetch 中的更多内容。

git fetch origin 仅从 origin 获取数据,git fetch --all 从所有远程获取数据(origin 是其中之一)

git fetch --all

--all
Fetch all remotes.

如果你想获取所有数据,同时还要删除
删除的数据添加 --prune 标志

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