Git - Fetch (Remote Repository Sync)


A fetch will sync information locally from a remote repository.

It will mostly

git fetch:

  • download new remote branch
  • download all commits added since the last fetch to the actual branch ( The head of the last fetch are saved in the fetch_head file.)
  • download new tags

from one or more other remote repositories

remote branche cannot be modify directly, you need to create a tracking branch (ie a local branch that tracks the remote branch head)


The last commit (head) fetched for all branches are in the FETCH_HEAD file located a git_dir/FETCH_HEAD 1)

Discover More
Git - Fork (Upstream)

A fork is an entire copy of a repository. The original repository of a fork is known as the upstream repository. It has the same concept as a upstream branch. see To sync your local repo with...
Git - Git (executable|command line)

The git executable where: --git-dir is the location of the repository files --work-tree is the location of the work tree Command Description add Add file contents to the index add--interactive...
Git - Pull

git pull incorporates commit (changes) from: a remote repository into the current branch. In its default mode, git pull is a shorthand for: git fetch followed by git merge ie git merge FETCH_HEAD...
Git - Remote (Tracked Repository)

A remote in Git is a remote repository (ie a remote git server). Git remote manage the set of repositories (“remotes”) whose branches you track. They are also called tracked repositories in reference...
Git - Remote and local Branch management

remote and local branch management To synchronize your work, you run: It will fetch everything the remote server has that you don’t have yet. git fetch updates your remote-tracking branches. ...
Git - Remote branch

A remote branch is a branch in a remote repository. (remote reference). Example: where: and To get the commit from a remote branch, you do a pull (ie a git fetch followed by git...
Git - Tracking Branch

Tracking branches are local branches that have set their upstream branch. tracking branchreference The local branches have then a direct relationship with their upstream branch that can be: a remote...
Git - Upstream Branch (Tracking branch)

An upstream is a configuration of a local branch that set the remote branch that it's tracking. cloning @{u} or @{upstream} means the upstream branch of the current branch @{upstream} or @{u}...
Branches Git
Git - Branch

This page talks Branch management in Git. For Git, a branch is: a commit name (ref) that points to the last commit (head) leaf in the commit log (or log) that represents a commit chain Example...

Share this page:
Follow us:
Task Runner