最近PC運がなくて、6ヶ月で3代目のMacなのですがそのたびに設定しているので自分の備忘録に。

vi ~.bashrcに
#git settings
PS1='\[\033[32m\]\u@\h\[\033[00m\]:\[\033[34m\]\w\[\033[31m\]\n$(__git_ps1)\[\033[00m\]\$'

source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh
source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash


GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWUNTRACKEDFILES=true
GIT_PS1_SHOWSTASHSTATE=true
GIT_PS1_SHOWUPSTREAM=auto

vi ~/.bash_profileに
if [ -f ~/.bashrc ] ; then
. ~/.bashrc
fi

私はブランチ名の前に改行したいのだ。
参考:bashでgitのブランチ名を表示

これmacの時はXcodeにgit-prompt.shとかgit-completion.bashが入ってるけど他の時はどうすればいいの...

と思ったけどこれをみて前設定したんだった
参考:git :: bash プロンプトにブランチ名と作業ツリーの状態を表示する


# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

# User specific aliases and functions


#gitsetting
source /usr/bin/git-core/git-completion.bash
source /usr/bin/git-core/git-prompt.sh

GIT_PS1_SHOWDIRTYSTATE=true
export PS1="\[\033[1;32m\]\[\033[0m\]\[\033[33m\]\H:\w\n\[\033[0m\][\u@ \W]\[\033[36m\]\$(__git_ps1)\[\033[00m\]\$ "