'git pull'和'git fetch'有什么区别? [英] What is the difference between 'git pull' and 'git fetch'?

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

问题描述

git pull git fetch

git pull < c>后面跟着一个 git merge



你可以做一个 git fetch 随时在 refs / remotes /< remote> / 下更新您的远程追踪分行。



此操作不会在 refs / heads 下改变您自己的任何本地分支,并且在不更改工作副本的情况下安全无虞。我甚至听说有人在后台执行cron作业时定期运行 git fetch >(尽管我不建议这样做)。



git pull 是您将本地分支带到远程版本的最新版本,同时还会更新您的其他远程跟踪分行。



Git文档: git pull


What are the differences between git pull and git fetch?

解决方案

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

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).

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 documentation: git pull

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

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