石锅拌饭

Tag: shell

可以显示git状态的shell prompt

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

[更新:2009/11/05] 增加了一个小功能,如果本地分支有未推送到对应远端分支的内容,会有提示。

最近看了一些和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

8 Comments :, , more...

晒历史

by Robin Lu on Apr.17, 2008, under Uncategorized

开始流行晒历史了,我也晒一下

localhost:~ splyb$ history | awk {'print $2'} | sort | uniq -c | sort -k1 -rn | head
 125 git
  81 cd
  56 ls
  32 rake
  28 ./script/server
  15 rm
  14 ll
  11 sc
  11 pwd
  10 ruby
4 Comments :, , , more...

Archives

Browse by tags