【问题标题】:Backup git repos, git fetch vs git remote update备份 git repos、git fetch 与 git 远程更新
【发布时间】:2013-07-22 16:34:31
【问题描述】:

我想使用这个 SO 答案备份 git repos:Backup a GitHub repository

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

唯一的区别是我使用git fetch 而不是git remote update

这两个命令有什么缺点吗? (从完整备份的角度来看,例如备份所有标签、分支)

【问题讨论】:

标签: git github


【解决方案1】:

基本上,除非您设置特定配置,否则git remote updates 会针对您的所有遥控器运行git fetch

man page 状态

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.&lt;group&gt;remotes.default,并且如果您唯一的远程是 github,则运行 git remote updategit fetch 是完全等效的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-11-26
    • 1970-01-01
    • 1970-01-01
    • 2013-05-26
    • 1970-01-01
    • 2014-03-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多