Skip to content

Commit

Permalink
Set up remotes/origin to track all remote branches.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Nov 7, 2005
1 parent f179044 commit 95d117b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Documentation/git-clone.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions git-clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 95d117b

Please sign in to comment.