`git fetch origin`和`git remote update origin`有什么区别?

编程入门 行业动态 更新时间:2024-10-28 06:33:13
本文介绍了`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`有什么区别?

本文发布于:2023-11-24 19:06:25,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:有什么区别   fetch   git   origin   update

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!