简体   繁体   中英

Why does git show “--merged” / “--no-merged” instead of branch names?

Git branch shows -merged and -no-merged instead of branch names.

How to disable this feature and see the actual branch names?

Git 分支

Your screenshot—which I have manually retyped, hence possibly introducing various errors—appears to show the following:

$ git branch
  german
* master
  newAutosuggest
  release-candidate
  release_v3.1.2
  â<U+0080>-merged
  â<U+0080>-no-merged
  â<U+0080>-merged
  -no-merged

The line with master is in green (normal for the current branch) and the lines that have <U+0080> have that part printed in inverse video, indicating that your pager has highlighted this to imply that it's an expansion of an unprintable character.

The â (Unicode LATIN SMALL LETTER A WITH CIRCUMFLEX, U+00E2) character and the expanded-out U+0080 indicate that you have branch names that use non-ASCII characters.

The names â<U+0080>-merged and â<U+0080>-merged appear visually identical, and I typed them in as two identical names, but this should be impossible. It seems likely to me that at least one of the apparent hyphen - characters is actually an en-dash U+2013 character. This would also explain the appearance of the -no-merged name: if at least the leading hyphen, and perhaps both hyphens, are actually en-dash characters, rather than hyphens, they would be usable as Git branch names.

Deleting these names may be easy or difficult, depending on your familiarity with Unicode and access to tools to generate the correct Unicode byte sequences. It may also depend on whether your OS actually uses Unicode.

If all else fails, consider working directly "behind Git's back" as it were with the files in the .git/refs/ directory and/or the single file .git/packed-refs . Be very careful if you edit these the packed-refs file manually: make sure that your editor is not converting everything to, say, UTF-16-LE encoding (a Microsoft favorite), nor inserting pointless byte order marks.

Note that other programs that go behind Git's back (reach directly into the repository and change things without asking or informing Git) can create branches whose names contain invalid hyphens. If that has happened, the way to fix it is to go behind Git's back again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM