简体   繁体   English

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

[英]What is the difference between 'git remote update', 'git fetch' and 'git pull'?

I'm starting to play with Git now and I'm a little bit confused. 我现在开始和Git玩了,我有点困惑。 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远程更新
  • git fetch git fetch
  • git pull 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 remote update将更新所有分支集以跟踪远程分支,但不会合并任何更改。

git fetch will update only the branch you're on, but not merge any changes in. git fetch将仅更新您所在的分支,但不会合并任何更改。

git pull will update and merge any remote changes of the current branch you're on. git pull将更新合并您当前分支的任何远程更改。 This would be the one you use to update a local branch. 这将是您用于更新本地分支的那个。

Not sure about the git remote update, but git pull is the git fetch followed automatically by a git merge... 不确定git远程更新,但是git pull是由git merge自动跟随的git fetch ...

This is partially a duplicate. 这部分是重复的。 Check: What is the difference between 'git pull' and 'git fetch'? 检查: 'git pull'和'git fetch'有什么区别?

Also, if it means anything to you, I've never used git remote update neither fgit fetch. 此外,如果它对你来说意味着什么,我从来没有使用过git remote update和fgit fetch。 You can do just fine with pull, commit and push. 拉,提交和推送都可以做得很好。

Hope it helps.. 希望能帮助到你..

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM