Created
February 6, 2016 08:14
-
-
Save gh640/ec315d5ad0835842c5ea to your computer and use it in GitHub Desktop.
Bash PS1 for Git repository
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 characters
| # Show Git branch name and number of changed files | |
| # if current directory is in Git repo. | |
| # カレントディレクトリが Git リポジトリの場合に | |
| # 現在のブランチと変更ファイルの数を表示する形にコマンドプロンプトをカスタマイズする | |
| if [ $TERM == xterm ]; then | |
| PS1='\[$(tput setaf 4)\]\u:\W\$\[$(tput sgr0)\]$(if git status &>/dev/null;then echo \[$(tput setaf 5)\][$(git branch | grep ^\* | cut -d " " -f 2) changed:$(git status -s | wc -l)]\[$(tput sgr0)\];fi) ' | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment