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

Re: [Improvement?] How do you switch branches in a bare repo?

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Mar 12, 2010, 16:48 UTC
Message-ID
<20100312164835.GA2303@progeny.tock>
In-Reply-To
<b4087cc51003120009o7bd99609w996de02b732fbbd9@mail.gmail.com>
Michael Witten wrote:
Show 9 quoted lines
> Commands like "git checkout" and "git reset" essentially operate on 2
> aspects of a repository:
> 
>     (1) The repository's state.
>     (2) The repository's working tree.
> 
> Is there any reason why these commands can't just operate on (1) in a
> bare repository, thereby allowing users to use familiar commands to
> get their work done?

Not that I can think of. I’d say go for it. (I’ll be glad to help in any way I can. Not sure I’ll have much time soon, but I can answer questions, look over patches, and so on.)

> The "git checkout" command in a bare repository should serve to select
> on which branch other commands (like "git reset") operate, etc.

My only worry would be low-level scripts that want to be able to use a separate index or work tree with a bare repository. Maybe the index file could be in a special "bare" state to request the semantics you’re describing.

Jonathan
Previous: Michael WittenNext: Junio C Hamano
Message 7 of 8 in “How do you switch branches in a bare repo?”
  1. Adam NielsenMar 12, 2010
  2. Johannes SixtMar 12, 2010
  3. Adam NielsenMar 12, 2010
  4. Johannes SixtMar 12, 2010
  5. Adam NielsenMar 12, 2010
  6. Michael WittenMar 12, 2010
  7. Jonathan NiederMar 12, 2010
  8. Junio C HamanoMar 14, 2010

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.