简体   繁体   English

为什么 git 显示“--merged”/“--no-merged”而不是分支名称?

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

Git branch shows -merged and -no-merged instead of branch names. Git 分支显示-merged-no-merged而不是分支名称。

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.带有master的行是绿色的(对于当前分支是正常的),带有<U+0080>的行以反色视频打印了该部分,表明您的寻呼机已突出显示它以暗示它是不可打印字符的扩展。

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. â (Unicode 拉丁小写字母 A WITH CIRCUMFLEX,U+00E2)字符和扩展的 U+0080 表示您有使用非 ASCII 字符的分支名称。

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.名称â<U+0080>-mergedâ<U+0080>-merged在视觉上看起来相同,我将它们输入为两个相同的名称,但这应该是不可能的。 It seems likely to me that at least one of the apparent hyphen - characters is actually an en-dash U+2013 character.在我看来,至少一个明显的连字符-字符实际上是一个破折号 U+2013 字符。 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.这也可以解释-no-merged名称的出现:如果至少前导连字符(可能还有两个连字符)实际上是短划线字符,而不是连字符,它们将可用作 Git 分支名称。

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.删除这些名称可能容易或困难,具体取决于您对 Unicode 的熟悉程度以及对生成正确 Unicode 字节序列的工具的访问权限。 It may also depend on whether your OS actually uses Unicode.它还可能取决于您的操作系统是否实际使用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 .如果所有其他方法都失败了,请考虑直接“在 Git 的背后”工作,就像使用.git/refs/目录和/或单个文件.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.如果您手动编辑这些打包参考文件,请务必小心:确保您的编辑器没有将所有内容都转换为 UTF-16-LE 编码(Microsoft 最喜欢的),也没有插入无意义的字节顺序标记。

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.请注意,go 在 Git 背后的其他程序(直接进入存储库并在不询问或通知 Git 的情况下更改内容)可以创建名称包含无效连字符的分支。 If that has happened, the way to fix it is to go behind Git's back again.如果发生这种情况,修复它的方法是再次在 Git 背后的 go 。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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