git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rene Herman <rene.herman@gmail.com>
To: Brian Gernhardt <benji@silverinsanity.com>
Cc: git@vger.kernel.org
Subject: Re: git branch --switch?
Date: Tue, 17 Apr 2007 17:41:30 +0200	[thread overview]
Message-ID: <4624EAAA.6040000@gmail.com> (raw)
In-Reply-To: <C940520E-732A-4F6E-A7F2-0215FD534455@silverinsanity.com>

On 04/17/2007 04:31 PM, Brian Gernhardt wrote:

>> Is it possible to switch the current branch without checking it out? 
>> Not really essential, but I'm happily flaundering around with git and 
>> still start from scratch fairly regularly; to speed this up I've found 
>> the -n switch to git clone useful and would like something similar 
>> when reconstructing my "branch hierarchies".
>>
>> Upto now I only know about "git checkout" (with or without -b) to 
>> switch the current branch. As said it's not really essential, but I 
>> was expecting there would be something like a "branch --switch". Did I 
>> overlook it?
> 
> Perusing git-checkout points me to git-symbolic-ref to update the HEAD 
> ref to a new branch:
> 
> git symbolic-ref HEAD refs/heads/<branch>
> 
> However, I'm somewhat confused as to why you'd want HEAD and the working 
> directory to get out of sync.

Thank you for the answer. Well, as said, it's not essential, but I was just 
now rebuilding a repo and have a few branches that I all want to be based on 
the same revision. Say, branch a, b and c, based on v2.6.20.

git clone -l -s -n <a local linux repo> local
git checkout -b v20 v2.6.20
git branch a
git branch b
git branch c

Step 1, 3, 4 and 5 of this are nearly instantaneous but 2 isn't -- this repo 
sits on a P1 with 64M of memory and a disk doing 8 M/s which is probably the 
only reason I thought asking about it was a good idea in the first place...

You'd be quite right in saying that there isn't much point; if I want to now 
start populating branch a, I have to "git checkout a" anyway, and that 
action _will_ now be instantaneous. If I'd replaced 2 with:

git branch --create-and-set-as-current v20 v2.6.20

then I will not have won any time until that 6th "git checkout a" step.

The checkout of v20 was superfluous in this though, and I just expected I 
should be able to skip that. It fitted my mental model...

Rene.

  reply	other threads:[~2007-04-17 15:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-17 13:36 git branch --switch? Rene Herman
2007-04-17 14:21 ` Alex Riesen
2007-04-17 14:29   ` Rene Herman
2007-04-17 14:46   ` Brian Gernhardt
2007-04-17 15:11     ` Alex Riesen
2007-04-17 15:44       ` Rene Herman
2007-04-17 14:31 ` Brian Gernhardt
2007-04-17 15:41   ` Rene Herman [this message]
2007-04-17 15:47     ` Rene Herman
2007-04-17 15:55     ` Lars Hjemli
2007-04-17 16:10       ` Rene Herman
2007-04-17 16:50         ` Randal L. Schwartz
2007-04-17 17:03           ` Rene Herman
2007-04-17 17:00         ` Lars Hjemli
2007-04-17 17:27           ` Rene Herman
2007-04-17 16:24     ` Rene Herman
2007-04-17 16:44       ` Linus Torvalds
2007-04-17 16:55         ` Rene Herman

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=4624EAAA.6040000@gmail.com \
    --to=rene.herman@gmail.com \
    --cc=benji@silverinsanity.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).