Skip to main content
  1. Learn center
  2. Software Development
  3. Guides
  4. Git tutorial
  5. Git collaboration
  6. Remote branches
  7. Fetching remote branches
GuidesSoftware DevelopmentBacklog
Git

Project and code management together.

Fetching remote branches

The changes from the remote branch automatically merge into your current local branch when executing a pull as long as there are no conflicts. If you want to obtain the remote changes but not have them merged into your current local branch, you can execute the git fetch command.

Fetch will download changes from the remote that do not yet exist on your local branch. TheFETCH_HEAD ref will track the fetched changes from the remote repository.

When both the remote and local branches contain different descendants, the revision history will look like this:

Diagram displaying revision history of branches with different mains.
Revision history when remote and local branches have different mains.

Once changes are fetched, you can apply those changes to your local repository by merging in FETCH_HEAD or executing a pull.

Diagram displaying changes applied to local repo after mergeing.
After merging, changes are applied to the local repo.

Once FETCH_HEAD has merged, the revision history will yield the same result as a git pull operation. Pull is a simultaneous execution of fetch and merge operations.

Subscribe to our newsletter

Learn with Nulab to bring your best ideas to life