Skip to content

Instantly share code, notes, and snippets.

@KanshuYokoo
Created March 28, 2018 04:29
Show Gist options
  • Save KanshuYokoo/61c7df6f4e755b28838b44bd6410ae3f to your computer and use it in GitHub Desktop.
Save KanshuYokoo/61c7df6f4e755b28838b44bd6410ae3f to your computer and use it in GitHub Desktop.
how to retrieve branch name by bash. for the use of bash prompt. very famous script.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment