石锅拌饭

Tag: git

可以显示git状态的shell prompt

by Robin Lu on Jan.15, 2009, under Uncategorized

最近看了一些和shell prompt 有关的文章,把自己的shell prompt调整了一下。

在一般目录里就是这样:
Prompt1
分别显示用户名@主机、时间和当前目录。

如果当前目录刚好是一个git repository,就是这样:
Prompt2
后面会多出当前的git branch的名字。

如果当前git repository有还没提交的内容,git branch名就是红色的:
Prompt3

这是我使用的prompt文件,可以把它的内容加在.bash_profile或者source引用到环境脚本里。

. prompt.sh

适用环境为Mac OS X 10.5的Terminal+bash。

相关文章:
Tip: Prompt Magic
bashish
add the current git branch to your prompt

7 Comments :, , more...



Archives

Browse by tags