`git fetch origin`和`git remote update origin`有什么区别? [英] What is the difference between `git fetch origin` and `git remote update origin`?

查看:1264
本文介绍了`git fetch origin`和`git remote update origin`有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为对的回应一个关于从git仓库一次提交一个提交的问题,我建议使用 git remote update 而不是 git fetch 。我已经阅读了两个手册页,但不能说我完全理解。



任何人都可以向我解释 git fetch origin 获取远程更新原点的行为有所不同吗?

解决方案



远程更新是一个非常高级的命令 - 它支持分组远程( remotes。< group> =< list> ),并且更新所有远程(除了那些使用 remote。< name> .skipDefaultUpdate set),但不是任何更具体的提取选项。尽管如此,它的功能与使用默认选项获取完全相同。



推荐远程更新而不是git fetch的回答实际上是不带远程名称的推荐,仅仅为了获取所有内容,而不仅仅是作为参数命名的那个。这相当于 git fetch --all



我应该加上提取和远程更新的警告,实际上使用相同的代码路径,直到v1.6.6.1(2009年12月23日发布)。即使在那之前,他们也做了基本相同的事情,只是使用不同的代码(可能在角落案件中表现略有不同),但我想不出任何可能的结果。


In response to a question about pulling one commit at a time from a git repository, I was recommended to use git remote update instead of git fetch. I have read both man pages but cannot say I understood either in its entirety.

Can anyone explain to me how git fetch origin and get remote update origin behave differently?

解决方案

It makes no difference when used like this.

remote update is a very high-level command - it supports grouped remotes (remotes.<group> = <list>), and updating all remotes (except those with remote.<name>.skipDefaultUpdate set), but not any of the more specific options of fetch. Under the hood, though, it does the exact same thing as fetch with the default options.

The answer recommending remote update instead of git fetch was actually recommending it without a remote name, just for the sake of fetching all, not just the one named as an argument. This is equivalent to git fetch --all.

I should add the caveat that fetch and remote update didn't actually use the same codepath until v1.6.6.1 (released December 23 2009). Even before that, though, they did essentially the same thing, just using different code (possibly behaving slightly differently in corner cases, but I can't think of any off the top of my head).

这篇关于`git fetch origin`和`git remote update origin`有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆