From: Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com>
To: git list <git@vger.kernel.org>
Subject: Clone a repo and checkout a specifc remote branch
Date: Sat, 7 Mar 2009 12:42:37 +0100 [thread overview]
Message-ID: <4d8e3fd30903070342q584315cjcd059dcfe558dcfd@mail.gmail.com> (raw)
Hi list,
I've got a few questions from a friend that used git for the first
time, I answered to all of them but the following.
Scenario:
He knows the URl of a git repository which contains a few branches. He
is interested only to a single specific branch.
He expected to manage to clone the specific remote branch with a
single command, instead he had to learn the following procedure:
$ git clone git://uri_of_the_repo localdir
$ cd localdir
$ git branch
* master
# OK, so now he cloned the whole repository and checked out the master branch
$ git checkout mybranch origin/coolbranch
Wouldn't be an improvement to let the user to specify which remote
branch he want to be checked out after a clone?
Something like:
$ git clone git://uri_of_the_repo:coolbranch localdir
to get a clone of the whole repository and to check out the
origin/coolbranch remote branch?
I quickly discussed this scenario on the #git channel and a user
suggested to use the following procedure:
$ git init
$ git fetch git://uri_of_the_repo coolbranch
which was new to me, I tried it as follow:
$ git fetch git://git.kernel.org/pub/scm/git/git.git man
remote: Counting objects: 7319, done.←[K
remote: Compressing objects: 100% (1536/1536), done.←[K
remote: Total 7319 (delta 5640), reused 7290 (delta 5625)←[K
Receiving objects: 100% (7319/7319), 1.40 MiB | 110 KiB/s, done.
Resolving deltas: 100% (5640/5640), done.
From git://git.kernel.org/pub/scm/git/git
* branch man -> FETCH_HEAD
but now I don't understand how to checkout the branch :-/
Ciao,
--
Paolo
http://paolo.ciarrocchi.googlepages.com/
http://mypage.vodafone.it/
next reply other threads:[~2009-03-07 11:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-07 11:42 Paolo Ciarrocchi [this message]
2009-03-07 18:53 ` Clone a repo and checkout a specifc remote branch Patrick Notz
2009-03-07 23:25 ` Paolo Ciarrocchi
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=4d8e3fd30903070342q584315cjcd059dcfe558dcfd@mail.gmail.com \
--to=paolo.ciarrocchi@gmail.com \
--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).