Skip to content

Instantly share code, notes, and snippets.

@s2kw
Created March 8, 2016 02:13
Show Gist options
  • Save s2kw/8a62f12d4c1ea65e23da to your computer and use it in GitHub Desktop.
Save s2kw/8a62f12d4c1ea65e23da to your computer and use it in GitHub Desktop.
.bash_profileに書き込むとbranch名が表示されつつ適当にカラフルになるからCUI苦手な人用に
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
export PS1="\[\e[0;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
# \[\e[0;32m\]\u\[\e[m\] green color with user name
# \[\e[1;34m\]\w\[\e[m\] blue color with path
@s2kw
Copy link
Author

s2kw commented Jul 13, 2023

source ~/.bash_profile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment