git の branchをプロンプトに表示
検索するといろいろとやり方はありそうだが、以下「参考」の一番上の手順でうまくいった。
- ざっくりと概要をまとめると以下の通り
- git-prompt.sh と git-completion.bash をダウンロード
- .bashrcに以下を記述
if [ -f ~/git-completion.bash -a -f ~/git-prompt.sh ]; then source ~/git-completion.bash GIT_PS1_SHOWDIRTYSTATE=1 source ~/git-prompt.sh PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ ' fi