User Tools

Site Tools


git_remote_tracking_branches

This is an old revision of the document!


Table of Contents

Overview

Remote tracking branches, and how they work.

Terminology

  • master: local tracking branch
  • origin/master: remote tracking branch
  • master on remote system: remote branch

All of these branches can be “out of sync” with one another.

Simple example

Examples using the Linux kernel source repository.

$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
$ git show master
commit 1c163f4c7b3f621efff9b28a47abb36f7378d783 (HEAD -> master, tag: v5.0, origin/master, origin/HEAD)
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Sun Mar 3 15:21:29 2019 -0800

    Linux 5.0

diff --git a/Makefile b/Makefile
index ac5ac28a24e9..d5713e7b1e50 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 VERSION = 5
 PATCHLEVEL = 0
 SUBLEVEL = 0
-EXTRAVERSION = -rc8
+EXTRAVERSION =
 NAME = Shy Crocodile
 
 # *DOCUMENTATION*
$
$ git show origin/master
commit 1c163f4c7b3f621efff9b28a47abb36f7378d783 (HEAD -> master, tag: v5.0, origin/master, origin/HEAD)
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Sun Mar 3 15:21:29 2019 -0800

    Linux 5.0

diff --git a/Makefile b/Makefile
index ac5ac28a24e9..d5713e7b1e50 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 VERSION = 5
 PATCHLEVEL = 0
 SUBLEVEL = 0
-EXTRAVERSION = -rc8
+EXTRAVERSION =
 NAME = Shy Crocodile
 
 # *DOCUMENTATION*
$

Fetch, but do not merge, which updates the remote tracking branch, but not the local tracking branch:

$ git fetch
remote: Counting objects: 53547, done.
remote: Compressing objects: 100% (20826/20826), done.
remote: Total 53547 (delta 38450), reused 43614 (delta 32435)
Receiving objects: 100% (53547/53547), 41.90 MiB | 11.16 MiB/s, done.
Resolving deltas: 100% (38450/38450), done.
From https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
   1c163f4c7b3f..1fc1cd8399ab  master     -> origin/master
$
git_remote_tracking_branches.1551987046.txt.gz · Last modified: 2019/03/07 19:30 by rpjday