Set up remotes/origin to track all remote branches.
authorJunio C Hamano <junkio@cox.net>
Sun, 6 Nov 2005 08:52:57 +0000 (00:52 -0800)
committerJunio C Hamano <junkio@cox.net>
Mon, 7 Nov 2005 02:17:14 +0000 (18:17 -0800)
This implements the idea Daniel Barkalow came up with, to match
the remotes/origin created by clone by default to the workflow I
use myself in my guinea pig repository, to have me eat my own
dog food.

We probably would want to use either .git/refs/local/heads/*
(idea by Linus) or .git/refs/heads/origin/* instead to reduce
the local ref namespace pollution.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Documentation/git-clone.txt
git-clone.sh

index cbd83f35d75b3b1551edf04934d8a2a94db17821..fefd2985f3f1424ddaff24fed6b57a85b86f8acc 100644 (file)
@@ -25,7 +25,8 @@ This is to help the typical workflow of working off of the
 remote `master` branch.  Every time `git pull` without argument
 is run, the progress on the remote `master` branch is tracked by
 copying it into the local `origin` branch, and merged into the
-branch you are currently working on.
+branch you are currently working on.  Remote branches other than
+`master` are also added there to be tracked.
 
 
 OPTIONS
index 1adf604172d5131222e152509c750f1e5a4ed9b0..4fdd6525148d50bd3a014bfc0f60eefd0f16efb9 100755 (executable)
@@ -202,8 +202,16 @@ then
                mkdir -p .git/remotes &&
                echo >.git/remotes/origin \
                "URL: $repo
-Pull: $head_points_at:origin"
-               cp ".git/refs/heads/$head_points_at" .git/refs/heads/origin
+Pull: $head_points_at:origin" &&
+               cp ".git/refs/heads/$head_points_at" .git/refs/heads/origin &&
+               find .git/refs/heads -type f -print |
+               while read ref
+               do
+                       head=`expr "$ref" : '.git/refs/heads/\(.*\)'` &&
+                       test "$head_points_at" = "$head" ||
+                       test "origin" = "$head" ||
+                       echo "Pull: ${head}:${head}"
+               done >>.git/remotes/origin
        esac
 
        case "$no_checkout" in