Skip to content

Instantly share code, notes, and snippets.

@LucasCalazans
Created June 17, 2019 16:31
Show Gist options
  • Save LucasCalazans/52771aac70392d3614ef10b216591e48 to your computer and use it in GitHub Desktop.
Save LucasCalazans/52771aac70392d3614ef10b216591e48 to your computer and use it in GitHub Desktop.
Add git branch to terminal line
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
PS1='[\u@\h \W]$(parse_git_branch)\$ '
@LucasCalazans
Copy link
Author

Add the above code to this file: ~/.bashrc

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