[PATCH] Set up remotes/origin to track all remote branches.
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:10
Subsystem:
documentation, the rest · Maintainers:
Jonathan Corbet, Linus Torvalds
Daniel Barkalow [off-list ref] writes:
On Thu, 3 Nov 2005, Junio C Hamano wrote:quoted
My "guinea pig" repository has this in $GIT_DIR/remotes/origin: URL: git://git.kernel.org/pub/scm/git/git.git Pull: master:origin Pull: +pu:pu Pull: maint:maintShouldn't approximately this be what git-clone sets up for you? If it's getting those heads initially, it should keep the information for future use. The only thing it wouldn't know would be the "+" on pu.
I think this makes sense, and especially so, once we later change the default behaviour of 'git clone' to clone but rename the remote refs to somewhere else. -- >8 -- cut here -- >8 -- 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 <redacted> --- Documentation/git-clone.txt | 3 ++- git-clone.sh | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) applies-to: 9cc3928769f8f4e3597fa446321112c0568514df a0b45ee2b1362d664cca2d81f2915ed3b903b252
diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index cbd83f3..fefd298 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt@@ -25,7 +25,8 @@ This is to help the typical workflow of 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
diff --git a/git-clone.sh b/git-clone.sh
index 1adf604..4fdd652 100755
--- a/git-clone.sh
+++ b/git-clone.sh@@ -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
--- 0.99.9.GIT