LoginSignup
9
9

More than 5 years have passed since last update.

bashにgitのブランチ名を表示する

Last updated at Posted at 2016-09-27

結論

1.以下のリンクからgit-prompt.shとgit-completion.bashをダウンロード
https://github.com/git/git/tree/master/contrib/completion

2.ダウンロードしたファイルを移動
sudo mkdir -p /usr/local/git/contrib/complation/
sudo mv git-completion.bash /usr/local/git/contrib/complation/
sudo mv git-prompt.sh /usr/local/git/contrib/complation/

3..bashrcに追加する
source /usr/local/git/contrib/completion/git-prompt.sh
source /usr/local/git/contrib/completion/git-completion.bash
GIT_PS1_SHOWDIRTYSTATE=true
export PS1='[\033[32m]\u@\h[\033[00m]:[\033[34m]\w[\033[31m]$(__git_ps1)[\033[00m]\$ '

4..bashrcを適用させて終了
source ~/.bashrc

※動作環境
OS X 10.11.4

参考文献

bashでgitのブランチ名を表示
http://qiita.com/tanishi/items/2adb71024d675bc43177

9
9
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
9
9