git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: GIT list <git@vger.kernel.org>
Subject: RFC: script to add another remote
Date: Thu, 22 Feb 2007 17:16:35 -0500	[thread overview]
Message-ID: <1172182595.20817.26.camel@dv> (raw)

Hello!

I'm trying to find the best way to add a new remote to an existing
repository, create a local branch for it and make it easy to switch to
that branch and back and to update all branches.

This is important because some Linux developers want to publish their
branches without having to serve the whole Linux repository, which is
about 175Mb even if packed with repack.usedeltabaseoffset=true.

I have written a simple script "git-clone-more" to help users who want
to track more than one remote:


#!/bin/sh
set -e
if test $# -lt 2 || test $# -gt 4; then
	echo "Usage: git-clone-more URL REMOTE [BRANCH [REMBRANCH]]" >&2
	exit 1
fi
URL=$1
REMOTE=$2
BRANCH=${3-$REMOTE}
REMBRANCH=${4-master}
git-remote add "$REMOTE" "$URL"
git-fetch "$REMOTE"
git-config branch."$BRANCH".remote "$REMOTE"
git-config branch."$BRANCH".merge refs/heads/"$REMBRANCH"
git-checkout -b "$BRANCH" remotes/"$REMOTE"/"$REMBRANCH"


If there is any easier way to do the same thing?  Maybe we could extend
one of the git commands or make the above script another git command?

It's interesting that git-clone-more can be used instead of git-clone.
I can use it e.g. to check out git in an empty directory:

git-init
git-clone-more git://www.kernel.org/pub/scm/git/git.git git

-- 
Regards,
Pavel Roskin

             reply	other threads:[~2007-02-22 22:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-22 22:16 Pavel Roskin [this message]
2007-02-22 22:24 ` RFC: script to add another remote Junio C Hamano
2007-02-23  8:14   ` Pavel Roskin
2007-02-23  8:21     ` Junio C Hamano
2007-02-23  8:24       ` Pavel Roskin
2007-02-23  8:43         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1172182595.20817.26.camel@dv \
    --to=proski@gnu.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).