git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [Q] Changing the current branch (HEAD) in a bare repository - how?

From
BFBrian Foster <brian.foster@innova-card.com>
Date
Jun 9, 2008, 07:50 UTC
Message-ID
<a537dd660806090050t385db36fk15d44c88bd5183af@mail.gmail.com>
In-Reply-To
<200806090934.13564.brian.foster@innova-card.com>
Show 13 quoted lines
> Date: Friday 06 June 2008
> Subject: Re: [Q] Changing the current branch (HEAD) in a bare repository - how?
> From: Jakub Narebski <jnareb@gmail.com>
>
> "Brian Foster" <brian.foster@innova-card.com> writes:
>>  Using git 1.5.2.5 (Kubuntu 7.10) and a bare repository,
>>  I [ essentially swapped branch names `master' and `foo' ].
>>  Now, how do I change the current branch to the (new)
>>  `master'?  [ ... ]
>
> 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).
Jakub,
 Yes, I also believe that is the case (but have not confirmed).
 The reason for the exercise is the bare repository in question
 will be cloned by newbies, and I want things to "just work"
 out-of-the-box.  The (new) `master' is the development mainline
 (broadly meaning what has passed (usually my) review), and as
 such is nominally what Patches should be generated against.
 (It didn't start out that way due to some convoluted history that
 is not relevant.)  Hence --- with the caveat I'm also rather new
 to git --- it seems wise to ensure the default checked-out branch
 after a clone represents the nominal development line.  (Of course,
 I need/want to encourage the use of topic branches, but I see that
 as a rather different issue.)
Show 7 quoted lines
>>  I (ultimately) hand-edited `HEAD' [ as Dscho suggested ].
>
> You have to rely on plumbing:
>
>   $ git symbolic-ref HEAD master
>
> (see documentation for details).
 Ah!  Thanks for the hint.
cheers!
	-blf-
-- 
"How many surrealists does it take to   | Brian Foster
 change a lightbulb? Three. One calms   | somewhere in south of France
 the warthog, and two fill the bathtub  |   Stop E$$o (ExxonMobil)!
 with brightly-coloured machine tools." |      http://www.stopesso.com
Message 1 of 1 in “Re: [Q] Changing the current branch (HEAD) in a bare repository - how?”
  1. Brian FosterJun 9, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.