Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
git_remote_tracking_branches [2019/03/07 19:32] – [Simple example] rpjdaygit_remote_tracking_branches [2019/03/08 09:43] (current) – [Simple example] rpjday
Line 5: Line 5:
 ===== Terminology ===== ===== Terminology =====
  
-  * ''master'': local tracking branch +  * ''master'': local tracking branch (in local object store) 
-  * ''origin/master'': remote tracking branch+  * ''origin/master'': remote tracking branch (in local object store)
   * ''master'' on remote system: remote branch   * ''master'' on remote system: remote branch
  
Line 21: Line 21:
  
 nothing to commit, working tree clean nothing to commit, working tree clean
 +$
 </code> </code>
 +
 +Local tracking branch:
  
 <code> <code>
Line 46: Line 49:
 $ $
 </code> </code>
 +
 +Corresponding remote tracking branch:
  
 <code> <code>
Line 125: Line 130:
       cgroup/pids: turn cgroup_subsys->free() into cgroup_subsys->release() to fix the accounting       cgroup/pids: turn cgroup_subsys->free() into cgroup_subsys->release() to fix the accounting
 $ $
 +</code>
 +
 +===== Working with a remote tracking branch =====
 +
 +You can treat a remote tracking branch just like any other branch in that you can look, compare, cherry-pick and so on, but you can't check it out to make changes to it:
 +
 +<code>
 +$ git checkout origin/master
 +Checking out files: 100% (6413/6413), done.
 +Note: checking out 'origin/master'.
 +
 +You are in 'detached HEAD' state. You can look around, make experimental
 +changes and commit them, and you can discard any commits you make in this
 +state without impacting any branches by performing another checkout.
 +
 +If you want to create a new branch to retain commits you create, you may
 +do so (now or later) by using -b with the checkout command again. Example:
 +
 +  git checkout -b <new-branch-name>
 +
 +HEAD is now at 1fc1cd8399ab Merge branch 'for-5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
 +$
 +</code>
 +
 +If you want to incorporate all of that into your local tracking branch, you can just:
 +
 +<code>
 +$ git checkout master
 +$ git merge origin/master
 </code> </code>
  • git_remote_tracking_branches.1551987146.txt.gz
  • Last modified: 2019/03/07 19:32
  • by rpjday