LoginSignup
0
3

More than 5 years have passed since last update.

mac ターミナル 表示 git ブランチ名

Last updated at Posted at 2017-06-07

gitのブランチ名を表示したい!

parse_git_branch() {
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/'
}

export PS1='[\h:\W]\[\033[31m\]$(parse_git_branch)\[\033[00m\]:\$'
export LS_COLORS="no=00:fi=00:di=42:ex=34;1"

ユーザ名:カレントディレクトリ][ブランチ名]:$

Gitを使っていてターミナル操作の時にいちいち
git branch
で調べるの面倒だなぁと思ったのでこれでだいぶ楽に♪

$の前は下記のサイトでわかりやすく説明があるので、参考までに^^
http://www.yoheim.net/blog.php?q=20140309

0
3
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
0
3