备份git仓库,git fetch和git remote update的区别。

3

我想使用这个Stack Overflow的答案来备份git仓库:备份GitHub仓库

git clone --mirror git://github.com/user/project.git
git fetch

唯一的区别是我使用了git fetch而不是git remote update 这两个命令有什么缺点吗?(从完整备份的角度来看,例如备份所有标签和分支)

请查看此链接:https://dev59.com/j3I-5IYBdhLWcg3wbXxN - Danstahr
@Danstahr,谢谢,所以我只有一个远程仓库是github,那么这两个命令是一样的吗? - Howard
1个回答

1
基本上,除非您设置了特定的配置,git remote updates 会针对所有远程仓库运行 git fetch手册页面 指出:
update
Fetch updates for a named set of remotes in the repository as defined
by remotes.<group>. If a named group is not specified on the command 
line, the configuration parameter remotes.default will be used; if 
remotes.default is not defined, all remotes which do not have the 
configuration parameter remote.<name>.skipDefaultUpdate set to true 
will be updated. (See git-config[1]).

在您的情况下,如果您没有定义任何remotes.<group>remotes.default,并且如果您唯一的远程是github,则运行git remote updategit fetch完全等效。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接