码迷,mamicode.com
首页 > 其他好文 > 详细

git终端提示符

时间:2015-05-05 12:31:53      阅读:118      评论:0      收藏:0      [点我收藏+]

标签:

最近使用git bash的时候,看到默认的终端提示符不爽,主要是太长了。所以想对git终端提示符进行优化

默认git的终端提示符会是  用户名@设备名称 ,我想改成更短的来查看。

提示符是由一个环境变量定义的,叫做 PS1(是“prompt string one” 的简写)。我们可以通过 echo 命令来查看 PS1的内容:

echo $PS1
\[\033]0;$MSYSTEM:${PWD//[^[:ascii:]]/?}\007\]\n\[\033[32m\]\u@\h \[\033[33m\]\w$(__git_ps1)\[\033[0m\]\n$

  设置 PS1 变量的文件在windows和mac下位置是不一样的。

windows下位置:

# 假设 git 安装在 C:\Program Files目录下
C:\Program Files\Git\etc\profile

  打开该文件,找到:

PS1="$PS1"‘\u@\h ‘             # user@host<space>
PS1="$PS1"‘\[\033[33m\]‘       # change color
PS1="$PS1"‘\w‘                 # current working directory

  改成:

PS1="$PS1"‘\W‘                 # current working Name
PS1="$PS1"‘\[\033[33m\]‘       # change color
PS1="$PS1"‘ \$‘                 # end add <space>$

  

mac下位置:

~/.bash_profile

  

 

具体设置产考:

http://billie66.github.io/TLCL/book/chap14.html

 

 

git教程:

http://git-scm.com/docs

 

GitForWindows中文乱码问题:

https://github.com/mrljdx/GitForWindows-

 

mac oh_my_zsh 终端小黄叉提示:

http://foocoder.com/blog/wo-zai-yong-de-macruan-jian-2.html/

 

其他类似文档:

http://equation85.github.io/blog/customize-terminal-on-mac/

 

git终端提示符

标签:

原文地址:http://www.cnblogs.com/ayseeing/p/4478601.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!