-
-
Save neo-yuanyanjun/151ba335e0400bd6d6fc4951a52860a4 to your computer and use it in GitHub Desktop.
Revisions
-
yisibl revised this gist
Jan 6, 2014 . 1 changed file with 3 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,6 @@ # 在Mac、Linux 终端显示 Git 当前所在分支 1. 进入你的`home`目录 ``` @@ -39,7 +38,7 @@ 1. 完成 >Mac 下面启动的 shell 是 login shell,所以加载的配置文件是`.bash_profile`,不会加载`.bashrc`。如果你是 Mac 用户的话,需要再执行下面的命令,这样每次开机后才会自动生效: ``` echo "[ -r ~/.bashrc ] && source ~/.bashrc" >> .bash_profile -
yisibl revised this gist
Jan 6, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # 在Mac、Linux 终端显示Git当前所在分支 1. 首先,要保证你已经安装了Git,Git安装教程见:Git 安装 1. 进入你的‘home’目录 -
yisibl revised this gist
Jan 6, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # 在终端显示Git当前所在分支 1. 首先,要保证你已经安装了Git,Git安装教程见:Git 安装 1. 进入你的‘home’目录 -
yisibl revised this gist
Jan 6, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ vi .bashrc ``` 1. 将下面的代码加入到文件的最后处 ``` function git_branch { -
yisibl revised this gist
Jan 6, 2014 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,17 +17,17 @@ 将下面的代码加入到文件的最后处 ``` function git_branch { branch="`git branch 2>/dev/null | grep "^\*" | sed -e "s/^\*\ //"`" if [ "${branch}" != "" ];then if [ "${branch}" = "(no branch)" ];then branch="(`git rev-parse --short HEAD`...)" fi echo " ($branch)" fi } export PS1='\u@\h \[\033[01;36m\]\W\[\033[01;32m\]$(git_branch)\[\033[00m\] \$ ' ``` 1. 保存退出 1. 执行加载命令 -
yisibl revised this gist
Jan 6, 2014 . 1 changed file with 15 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,19 +4,19 @@ 1. 进入你的‘home’目录 ``` cd ~ ``` 1. 编辑`.bashrc`文件 ``` vi .bashrc ``` 将下面的代码加入到文件的最后处 ``` function git_branch { branch="`git branch 2>/dev/null | grep "^\*" | sed -e "s/^\*\ //"`" if [ "${branch}" != "" ];then @@ -28,19 +28,19 @@ function git_branch { } export PS1='\u@\h \[\033[01;36m\]\W\[\033[01;32m\]$(git_branch)\[\033[00m\] \$ ' ``` 1. 保存退出 1. 执行加载命令 ``` source ./.bashrc ``` 1. 完成 >mac下面启动的shell是login shell,所以加载的配置文件是.bash_profile,不会加载.bashrc。如果你是mac用户的话,需要再执行下面的命令,这样每次开机后才会自动生效: ``` echo "[ -r ~/.bashrc ] && source ~/.bashrc" >> .bash_profile ``` -
yisibl created this gist
Jan 6, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ # 在终端显示当前Git所在分支 1. 首先,要保证你已经安装了Git,Git安装教程见:Git 安装 1. 进入你的‘home’目录 ``` cd ~ ``` 1. 编辑`.bashrc`文件 ``` vi .bashrc ``` 将下面的代码加入到文件的最后处 ``` function git_branch { branch="`git branch 2>/dev/null | grep "^\*" | sed -e "s/^\*\ //"`" if [ "${branch}" != "" ];then if [ "${branch}" = "(no branch)" ];then branch="(`git rev-parse --short HEAD`...)" fi echo " ($branch)" fi } export PS1='\u@\h \[\033[01;36m\]\W\[\033[01;32m\]$(git_branch)\[\033[00m\] \$ ' ``` 1. 保存退出 1. 执行加载命令 ``` source ./.bashrc ``` 1. 完成 >mac下面启动的shell是login shell,所以加载的配置文件是.bash_profile,不会加载.bashrc。如果你是mac用户的话,需要再执行下面的命令,这样每次开机后才会自动生效: ``` echo "[ -r ~/.bashrc ] && source ~/.bashrc" >> .bash_profile ```