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

Re: Windows > git.exe > the result of "git branch" does not always highlight the current branch

From
Johannes Sixt <j6t@kdbg.org>
Date
Apr 10, 2018, 05:20 UTC
Message-ID
<4de8574c-1b64-408c-ca7e-c6e3de2dfa4a@kdbg.org>
In-Reply-To
<CAFLu24=o0nQveRpMJV-6dhvft0H9PgdBahisBi4EEg=G0BwhpQ@mail.gmail.com>
Am 09.04.2018 um 21:26 schrieb Hari Lubovac:
Show 17 quoted lines
> It appears to be just a reporting issue. Probably not a big deal, but
> I thought I should report this, if it hasn't been noticed: when a
> branch is switched to by being named with non-original
> character-casing, then it's not clear which branch is current.
> 
> Example:
> 
> C:\repo>git branch
> * bar
>    foo
> 
> C:\repo>git checkout Bar
> Switched to branch 'Bar'
> 
> C:\repo>git branch
>    bar
>    foo

The bug is not that the branch is not marked, but that you are permitted to check out a branch that does not exist. This is a side-effect of the fact that branch names are sometimes stored using file names, and, as we know, file names are case-insensitive on Windows. I don't know of any efforts to fix that (I assume that it is not just a simple fix). In the meantime, I can only recommend: if it hurts, don't do it.

If you call `git gc` before the checkout command, I would expect that you would not be able to check out branch 'Bar', because branches are represented unambiguously after 'gc' (not as file names).

-- Hannes
Previous: Johannes Schindelin
Message 6 of 6 in “Windows > git.exe > the result of "git branch" does not always highlight the current branch”
  1. Hari LubovacApr 9, 2018
  2. Stefan BellerApr 9, 2018
  3. Hari LubovacApr 9, 2018
  4. Johannes SchindelinApr 10, 2018
  5. Johannes SchindelinApr 10, 2018
  6. Johannes SixtApr 10, 2018

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.