1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Macのターミナルでブランチ名を表示させる

Posted at

.bashrcファイルを以下のように編集する
(参考サイトとは違い、ホスト名などは表示させない)

~/.bashrc
source /usr/local/etc/bash_completion.d/git-prompt.sh
source /usr/local/etc/bash_completion.d/git-completion.bash
GIT_PS1_SHOWDIRTYSTATE=true
if [ $UID -eq 0 ]; then
    PS1='\[\033[01m\]\w\[\033[31m\]$(__git_ps1)\[\033[00m\] $ '
else
    PS1='\[\033[01m\]\w\[\033[31m\]$(__git_ps1)\[\033[00m\] $ '
fi
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

設定を反映させる

source ~/.bashrc

完了!
image.png

参考サイト

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?