'git remote update','git fetch'和'git pull'有什么区别?

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

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

发布评论

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

>www.elefans.com

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