Set up remotes/origin to track all remote branches.
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>
Junio C Hamano committed
Nov 6, 2005 at 00:52 UTC
95d117b6051c01726b67d3151f83e47dd41c0743
2 files changed
+12
-3
Documentation/git-clone.txt
+2
-1
@@ -25,7 +25,8 @@ This is to help the typical workflow of working off of the
25
remote `master` branch. Every time `git pull` without argument
26
is run, the progress on the remote `master` branch is tracked by
27
copying it into the local `origin` branch, and merged into the
28
-branch you are currently working on.
28
+branch you are currently working on. Remote branches other than
29
+`master` are also added there to be tracked.
30
31
32
OPTIONS
git-clone.sh
+10
-2
@@ -202,8 +202,16 @@ then
202
mkdir -p .git/remotes &&
203
echo >.git/remotes/origin \
204
"URL: $repo
205
-Pull: $head_points_at:origin"
206
- cp ".git/refs/heads/$head_points_at" .git/refs/heads/origin
205
+Pull: $head_points_at:origin" &&
206
+ cp ".git/refs/heads/$head_points_at" .git/refs/heads/origin &&
207
+ find .git/refs/heads -type f -print |
208
+ while read ref
209
+ do
210
+ head=`expr "$ref" : '.git/refs/heads/\(.*\)'` &&
211
+ test "$head_points_at" = "$head" ||
212
+ test "origin" = "$head" ||
213
+ echo "Pull: ${head}:${head}"
214
+ done >>.git/remotes/origin
215
esac
216
217
case "$no_checkout" in