99

I had to format my laptop, and so I had to install Git again. However it is quite different from the one I had yesterday, the icon is not the default orange one anymore, it looks more like Chrome now.

git

The bash is quite different, including a purple "MINGW64" in every line. Why is it there?

Is this the new final version? Or did I download something different?

I downloaded https://github.com/git-for-windows/git/releases/download/v2.5.1.windows.1/Git-2.5.1-64-bit.exe from https://git-scm.com/downloads .

Thanks!

chicks
  • 2,393
  • 3
  • 24
  • 40
FelipeKunzler
  • 1,204
  • 1
  • 11
  • 17
  • 1
    There was just a release on Aug 31st. So you likely had an older version before that. This version clearly has a newer icon and newer shell configuration than the one you had before. We don't know what you downloaded though (since you didn't tell us) so can't say much about whether it was the right one. – Etan Reisner Sep 02 '15 at 14:59
  • 2
    Hi, I put the link on the question, the strange thing about the icon is that I couldn't find it anywhere else. Any clue about the "MINGW64" in every line or why is that there? Thanks! – FelipeKunzler Sep 02 '15 at 15:05
  • 1
    That's the new build. `MINGW64` is likely the platform. What does `declare -p PS1` say? It should have something for that bit in there (possibly a function call). If you don't like it you can change it. – Etan Reisner Sep 02 '15 at 15:07
  • Yeah, I don't know why that new icon isn't on the site under Logos or whatever. Maybe it snuck into the Windows build by accident or maybe the site is just lagging or maybe something else entirely. You could contact the git people if you directly if you want a more official answer. – Etan Reisner Sep 02 '15 at 15:10
  • When I type this line "declare -p PS1" I get the following: declare -x PS1="\\[\\033]0;\$MSYSTEM:\${PWD//[^[:ascii:]]/?}\\007\\]\\n\\[\\033[ 32m\\]\\u@\\h \\[\\033[35m\\]\$MSYSTEM \\[\\033[33m\\]\\w\\[\\033[36m\\]\`__git_ ps1\`\\[\\033[0m\\]\\n\$ " – FelipeKunzler Sep 02 '15 at 15:41
  • 1
    Everytime I install Git I have to search for this question – aliopi Nov 23 '17 at 07:24

9 Answers9

88

Easiest way to remove 'MINGW64' is to comment two lines in file:

\Git\etc\profile.d\git-prompt.sh
...
# PS1="$PS1"'\[\033[35m\]'       # change to purple
# PS1="$PS1"'$MSYSTEM '          # show MSYSTEM
raygreentea
  • 1,005
  • 8
  • 6
49

This is the new icon being used with Git for Windows 2.x. The website needs an update for that I guess but there are not many volunteers typically.

The MINGW64 is the value from the MSYSTEM environment variable. This has been included in the bash prompt by setting PS1 in the /etc/bash.bashrc file. You can either override this in your own $HOME/.profile or edit the distributed one to remove that if you prefer.

patthoyts
  • 32,320
  • 3
  • 62
  • 93
  • `$HOME/.profile` didn't exist for me, so I created it, copied the contents of `/etc/git-prompt.sh`, and modified it around the line `#show MSYSTEM` – Dylan Hildenbrand Oct 19 '16 at 15:41
  • 3
    The answer how to get rid of the pink _MINGW64_ is here https://stackoverflow.com/a/32912485/332788 – aliopi Nov 23 '17 at 07:30
21

MINGW64 is 'Minimum GNU for Windows 64 bit'. It's the name of a compiler used to build an extra copy of bash that "git for Windows" includes.

"Git for Windows" includes git plus a variety of additional software, which you may already have on your machine. This includes:

As PS1 tastes are generally personal you may prefer your existing setup.

If you want a real Unix environment on Windows

You can use WSL, and simply install real Linux x64 apps on the WSL Linux distribution.

If you want a Windows-native git, but don't want all the extra software

  • You can get a minimal build from nuget if you don't have any git apps installed.

  • But if you use a GUI that may also include an embedded git - personally I use the one included with Sourcetree. In my powershell profile:

    Add-PathVariable "${env:UserProfile}\AppData\Local\Atlassian\SourceTree\git_local\bin"

This provides git without any additional changes to your system or extra copies of other software.

(Add-Pathvariable comes from PSCX by the way)

mikemaccana
  • 110,530
  • 99
  • 389
  • 494
  • Downvoted due to the editorializing. Good info, though. – ctrueden May 10 '17 at 16:22
  • 5
    1) The phrase "whole bunch of unnecessary stuff" conveys your personal opinion about it. It would be more neutral and more technically accurate to describe what is included and why. Be respectful of the fact that people have put a lot of time into Git for Windows, it is a large community, and things are structured the way they are for good reasons. 2) Saying Git Bash "isn't actually a thing" is dismissive. It _is_ a thing: it's the prompt that ships with Git for Windows, built on MinGW. Saying it's "just someone's preferred PS1" implies a personal mandate rather than community-driven OSS. – ctrueden May 12 '17 at 14:54
  • 1
    I still think the language is a bit unfair—e.g., bash does not come with versions of Windows before recent Windows 10 updates; in general it would be fairer to state something like "includes git plus a variety of additional software intended to make Git work out of the box regardless of your existing Windows configuration." But I do really appreciate the effort, so I switched to an upvote. – ctrueden May 17 '17 at 21:47
  • @ctrueden Thanks, adjusted to specify Windows 10. – mikemaccana May 22 '17 at 16:01
  • Doesn't really answer question. – Jan Kyu Peblik May 03 '19 at 19:24
  • 2
    I rather see this as the only one attempting to answer the *real* question. Who really cares about the pink glyphs of "MINGW". – user2023370 Nov 05 '19 at 09:56
6

As stated by @patthoyts

MINGW64 is the new icon being used with Git for Windows 2.x. The MINGW64 is the value from the MSYSTEM environment variable. This has been included in the bash prompt by setting PS1 in the /etc/bash.bashrc file. You can either override this in your own $HOME/.profile or edit the distributed one to remove that if you prefer.

MINGW64 and the name of the system is something that we don't want to or need to see always and sometimes may want to remove them for effective use of display space. To do that, we just need to comment out 4 lines in \Git\etc\profile.d\git-prompt.sh which is typically inside your program files.

PS1="$PS1"'\[\033[32m\]'       # change to green
PS1="$PS1"'\u@\h '             # user@host<space>
PS1="$PS1"'\[\033[35m\]'       # change to purple
PS1="$PS1"'$MSYSTEM '          # show MSYSTEM

These are the 4 lines in git-prompt.sh, typically line number 14 to 17, that can be commented out by placing # at the start of each line to remove computer name shown in green and MSYSTEM shown in purple. If you just want to remove one of these, you can comment lines accordingly. It should look similar to this

# PS1="$PS1"'\[\033[32m\]'       # change to green
# PS1="$PS1"'\u@\h '             # user@host<space>
# PS1="$PS1"'\[\033[35m\]'       # change to purple
# PS1="$PS1"'$MSYSTEM '          # show MSYSTEM
Mayank Kumar Chaudhari
  • 16,027
  • 10
  • 55
  • 122
3

It's a little different in the new git versions.

  • copy the line below in /etc/bash.bashrc: export PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[35m\]$MSYSTEM\[\e[0m\] \[\e[33m\]\w\[\e[0m\]\n'"${_ps1_symbol}"' '

  • add it to ~/.bashrc and do some custom edit: export PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n '

    If you do not like the additional blank line when press Enter, just remove the \n above.

  • source the ~/.bashrc file: source ~/.bashrc

  • my terminal example:

    enter image description here

NOZUONOHIGH
  • 1,892
  • 1
  • 20
  • 20
  • This works to override PS1 utterly, but eliminates the git (branch) information from the prompt, which might make one wonder why a person is even using Git Bash as opposed to something less specific, like Cygwin with git installed and git-completion.bash in place (which in fairness one might wonder anyway). – Jan Kyu Peblik May 03 '19 at 19:21
3

export PS1="${PS1/\$TITLEPREFIX:}"; export PS1="${PS1/\$MSYSTEM }" >> ~/.bashrc

Jan Kyu Peblik
  • 1,435
  • 14
  • 20
  • 2
    Thanks for your answer. Can you explain how this works to solve the problem? – ggorlen May 04 '19 at 01:46
  • 1
    @ggorlen It overrides (progressively enhances) PS1 by substituting out the variables (and singular characters following them) with nothing at all. Nothing is required but running that command (and re-sourc'ing ~/.bashrc or re-running Git Bash). – Jan Kyu Peblik May 04 '19 at 01:57
  • Nice, thanks. I recommend that you edit your post to include that information for future readers. – ggorlen May 04 '19 at 02:15
  • @ggorlen Pass. There are already enough essays here posing as answers. Plus it's right there in a comment that bored bureaucrats can merely not delete pointlessly. (I like your website.) – Jan Kyu Peblik May 06 '19 at 02:17
2

Just a small addition. If Windows is installed on C Drive, then this is the path to edit the file git-prompt.sh and comment out the desired lines (usually 14-17):

C:\Program Files\Git\etc\profile.d
Mwalek
  • 29
  • 3
1

I just noticed this on my machine as well. The orange icon you're referring to is probably the Ubuntu icon you would normally get while running the "Bash on Ubuntu on Windows" app. However, when you installed GIT, it also uses a version of bash. The app is called "Git Bash" in the start menu.

When I simply typed "Bash" in the search box and then and pressed enter, Windows opened the "best match", which happens (in my case) to be GIT installation with MINGW64. If you type "Ubuntu" instead, or if you look at the start menu's choices, you should see the other bash.

This is important to know that the two environments are separate, since programs from one environment may not be installed in the other.

Celso
  • 176
  • 1
  • 9
1

The easiest way is to use:

$ parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'; }
$ export PS1="\u@ \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
aabiro
  • 3,842
  • 2
  • 23
  • 36
  • Don't parse `git branch` porcelain output to get current branch when you have the most reliable `git rev-parse --abbrev-ref HEAD` – Romain Valeri Aug 25 '23 at 09:00