简体   繁体   English

有没有办法让 windows 的 git bash 看起来像 ubuntu 的终端?

[英]Is there a way to make git bash for windows look like ubuntu's terminal?

The title says it all - i hate the default git bash look.标题说明了一切 - 我讨厌默认的 git bash 外观。 Is there a way to quickly change a theme without using 3d-party terminal programs?有没有不使用 3d 方终端程序快速更改主题的方法?

You can just modify your PS1 global variable.您可以修改 PS1 全局变量。 You can take a look on this variable doing你可以看看这个变量做

echo $PS1

You will see : code like \\[\\033[35m\\] start a color style and this code specifically \\[\\033[0m\\]\\ ends the color.你会看到:像\\[\\033[35m\\]这样的代码开始一个颜色样式,这个代码特别是\\[\\033[0m\\]\\结束颜色。

__git_ps1 is the reference of your branch. __git_ps1 是你的分支的引用。

With gitbash, by default you have :使用 gitbash,默认情况下你有:

\[\033]0;$TITLEPREFIX:${PWD//[^[:ascii:]]/?}\007\]\n\[\033[32m\]\u@\h \[\033[35m\]$MSYSTEM \[\033[33m\]\w\[\033[36m\]`__git_ps1`\[\033[0m\]\n$

but you can do something like :但您可以执行以下操作:

export PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]`__git_ps1`\[\033[0m\] \$> '

Put the previous line in your .bashrc: you can type this line in the prompt and go back typing >bash将上一行放在 .bashrc 中:您可以在提示中输入这一行,然后返回输入 >bash

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

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