Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between `git fetch origin` and `git remote update origin`?

Tags:

git

People also ask

What is the difference between git fetch and git remote update?

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.

Does git fetch update origin?

git fetch is the command that tells your local git to retrieve the latest meta-data info from the original (yet doesn't do any file transferring. It's more like just checking to see if there are any changes available). git pull on the other hand does that AND brings (copy) those changes from the remote repository.

What is git fetch origin?

The git fetch command downloads commits, files, and refs from a remote repository into your local repo. Fetching is what you do when you want to see what everybody else has been working on.

What's the difference between git fetch and git pull?

Git Fetch is the command that tells the local repository that there are changes available in the remote repository without bringing the changes into the local repository. Git Pull on the other hand brings the copy of the remote directory changes into the local repository.


It makes no difference when used like this.

remote update is a very high-level command - it supports grouped remotes (remotes.<group> = <list>), and updating all remotes (except those with remote.<name>.skipDefaultUpdate set), but not any of the more specific options of fetch. Under the hood, though, it does the exact same thing as fetch with the default options.

The answer recommending remote update instead of git fetch was actually recommending it without a remote name, just for the sake of fetching all, not just the one named as an argument. This is equivalent to git fetch --all.

I should add the caveat that fetch and remote update didn't actually use the same codepath until v1.6.6.1 (released December 23 2009). Even before that, though, they did essentially the same thing, just using different code (possibly behaving slightly differently in corner cases, but I can't think of any off the top of my head).