Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch names get mangled by color escapes #415

rivy opened this Issue Jun 14, 2018 · 0 comments


None yet
2 participants
Copy link

rivy commented Jun 14, 2018

  • GitLens Version: 8.3
  • VSCode Version: 1.24.0
  • OS Version: Microsoft Windows [Version 10.0.16299.431]


branch names are displayed in mangled form with missing associated commits when git config contains "color.branch=always".

Steps to Reproduce

  1. enable branch colors on shell command line:

    git config --global color.branch always
  2. branch names displayed within the "Branches" section of the Gitlens explorer will contain color escape codes, eg, "[32mmaster[m", and will not show any contained commits.


Using the git global option "-c color.branch=never" will definitively disable color for the git branch command, fixing both issues.

Addressing possible concerns of generality... by researching the git online documentation and Wikipedia, the "-c ..." option appears to have been introduced somewhere between the 1.7.0 - versions (being released in the Feb-2010 to Oct-2012 time frame).


PR #416 contains a fix.

Note: the fix has only been tested on my machine.

rivy added a commit to rivy/vscode-gitlens that referenced this issue Jun 14, 2018

rivy added a commit to rivy/vscode-gitlens that referenced this issue Jun 14, 2018

Fixes eamodio#415 - branch names mangled by color escapes
- add "-c color.branch=never" option to git branch commands, definitively disabling color branch output

.# Discussion

Branch names are mis-parsed if `git branch` output is colored (eg, when git is configured
with "config.branch=always"). Using the base "-c color.branch=never" option overrides any
user configuration, displaying git branch output as uncolored in all cases and fixing the

Notably, option ordering is important in this instance. The "-c ..." option is a git
base option, not a git branch subcommand option. So, as done here, it must be inserted
before the "branch" subcommand.

ref: Issue eamodio#415

@eamodio eamodio changed the title branch names mangled by color escapes Branch names get mangled by color escapes Jun 17, 2018

@eamodio eamodio added the type: bug label Jun 19, 2018

@eamodio eamodio added this to the Soon™ milestone Jun 19, 2018

@eamodio eamodio closed this in 3991f4a Jun 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.