Git development
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: "Brian Foster" <brian.foster@innova-card.com>
Cc: git@vger.kernel.org
Subject: Re: [Q] Changing the current branch (HEAD) in a bare repository - how?
Date: Fri, 06 Jun 2008 09:03:03 -0700 (PDT)	[thread overview]
Message-ID: <m3k5h2y2iz.fsf@localhost.localdomain> (raw)
In-Reply-To: <a537dd660806060843p4e92932x4e0f5464c5fd1da1@mail.gmail.com>

"Brian Foster" <brian.foster@innova-card.com> writes:

>  Using git 1.5.2.5 (Kubuntu 7.10) and a bare repository,
>  I started with (the commands and output below are typed
>  in by hand, mostly from memory):
> 
>     $ git branch -a
>     * master
>       foo
>     $
> 
>  and then changed the branch names:
> 
>     $ git branch -m master old-master
>     $ git branch -m foo master
> 
>  and got this:
> 
>     $ git branch -a
>       master
>     * old-master
>     $
> 
>  Now, how do I change the current branch to the (new)
>  `master'?  A `checkout' fails:
> 
>     $ git checkout master
>     fatal: /usr/bin/git-checkout cannot be used without a working tree.
>     $

In a bare repository it doesn't matter (almost) which branch is
current one (there is no _checked out_ branch, so it only matters as a
default checked out branch for clone, IIRC).
 
>  I (ultimately) hand-edited `HEAD' (apparently successfully),
>  but am wondering what I should have done or may have missed?

You have to rely on plumbing:

  $ git symbolic-ref HEAD master

(see documentation for details).
-- 
Jakub Narebski
Poland
ShadeHawk on #git

  parent reply	other threads:[~2008-06-06 16:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-06 15:43 [Q] Changing the current branch (HEAD) in a bare repository - how? Brian Foster
2008-06-06 15:47 ` Johannes Schindelin
2008-06-06 16:03 ` Jakub Narebski [this message]
     [not found] <200806090934.13564.brian.foster@innova-card.com>
2008-06-09  7:50 ` Brian Foster

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=m3k5h2y2iz.fsf@localhost.localdomain \
    --to=jnareb@gmail.com \
    --cc=brian.foster@innova-card.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