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

Git

Git Problem Overview


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 Solutions


Solution 1 - Git

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.

Solution 2 - Git

Not sure about the git remote update, but git pull is the git fetch followed automatically by a git merge...

This is partially a duplicate. Check: https://stackoverflow.com/questions/292357/whats-the-difference-between-git-pull-and-git-fetch

Also, if it means anything to you, I've never used git remote update neither fgit fetch. You can do just fine with pull, commit and push.

Hope it helps..

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDavi GarciaView Question on Stackoverflow
Solution 1 - GitMakotoView Answer on Stackoverflow
Solution 2 - GitLucasAView Answer on Stackoverflow