“git pull"和“git fetch"有什么区别?

编程入门 行业动态 更新时间:2024-10-27 12:29:38
本文介绍了“git pull"和“git fetch"有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

git pull 和 git fetch 有什么区别?

推荐答案

简单来说,git pull 执行一个 git fetch 然后是一个 git merge.

In the simplest terms, git pull does a git fetch followed by a git merge.

您可以随时执行 git fetch 以更新 refs/remotes// 下的远程跟踪分支.此操作永远不会更改 refs/heads 下您自己的任何本地分支,并且无需更改您的工作副本即可安全执行.我什至听说有人在后台的 cron 作业中定期运行 git fetch(虽然我不建议这样做).

You can do a git fetch at any time to update your remote-tracking branches under refs/remotes/<remote>/. This operation never changes any of your own local branches under refs/heads, and is safe to do without changing your working copy. I have even heard of people running git fetch periodically in a cron job in the background (although I wouldn't recommend doing this).

git pull 是您将本地分支的远程版本更新为最新版本,同时更新其他远程跟踪分支的方法.

A git pull is what you would do to bring a local branch up-to-date with its remote version, while also updating your other remote-tracking branches.

来自 git pull 的 Git 文档:

From the Git documentation for git pull:

在默认模式下,git pull 是 git fetch 后跟 git merge FETCH_HEAD 的简写.

In its default mode, git pull is shorthand for git fetch followed by git merge FETCH_HEAD.

更多推荐

“git pull"和“git fetch"有什么区别?

本文发布于:2023-11-24 19:03:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1626451.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:有什么区别   pull   git   fetch   quot

发布评论

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

>www.elefans.com

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