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

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

问题描述

现在我开始玩Git了,而且我有点困惑。对我而言,看起来有很多选项可以做同样的事情。现在我的问题是下面的命令有什么不同:


  • git远程更新

  • git fetch

  • git pull



还有哪一个更适用于更新本地副本一个远程分支?

解决方案

git remote update 分支设置为跟踪远程分支,但不合并任何更改。



git fetch 将只更新您的分支',但不会合并任何更改。



git pull 会更新合并当前分支的任何远程更改。这将是您用来更新本地分行的人。


I'm starting to play with Git now and I'm a little bit confused. For me, looks like there are a lot of options to do the same thing. My question for now is what is the difference between the commands below:

  • git remote update
  • git fetch
  • git pull

Also which one is more applicable for update a local copy of a remote branch?

解决方案

git remote update will update all of your branches set to track remote ones, but not merge any changes in.

git fetch will update only the branch you're on, but not merge any changes in.

git pull will update and merge any remote changes of the current branch you're on. This would be the one you use to update a local branch.

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

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