表示内容を変更し、色をつけるようにします。
参考リンク
https://qiita.com/varmil/items/9b0aeafa85975474e9b6
git-completion.bashが無い場合
http://cybermergina.hateblo.jp/entry/2018/05/25/182328
-
git-completion.bash ファイルをgitフォルダと同じディレクトリに配置する。
(gitフォルダ内ではないので注意) -
同じディレクトリ内にある .bashrc ファイルに下記のソースを記述します。
※隠しファイルなので、macの場合は、command + shift + . で表示させます。
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
ここから下を記述
iTermでブランチ名出す設定は、下記を記載してください
function git_ps() {
git branch --no-color 2> /dev/null | sed -e 's/ //g' | sed -e '/^[^*]/d' -e 's/*\(.*\)/\1/'
}
export PS1='\[\033[00m\]\u@\h\[\033[00m\]:\[\033[32m\]\w\[\033[35m\] [$(git_ps)]\[\033[00m\]\$ '
// ここから上を記述
export PATH=/usr/bin/X11:$PATH
これで、現在のブランチを常に表示するようになり色付きにもなります。
色コードの変更は下記を参照に
https://qiita.com/wildeagle/items/5da17e007e2c284dc5dd