dotfiles icon indicating copy to clipboard operation
dotfiles copied to clipboard

how to incorporate git branch into bash terminal

Open bongsoos opened this issue 10 years ago • 1 comments

I want to have git branch information but if I write the below code to the bash_local, I lose the original setting. How do I keep the original setting and incorporate the following code? The below code is from "software carpentry".

Set the prompt to show the current git branch:

function parse_git_branch { ref=$(git symbolic-ref HEAD 2> /dev/null) || return echo "("${ref#refs/heads/}")" }

PS1="\h:\W$RED $(parse_git_branch)$NO_COLOR $"

bongsoos avatar Jul 08 '15 22:07 bongsoos

The bash prompt is handled by the prompt plugin in bpm. There's no easy way to extend it yet. But we can certainly brainstorm how to do that, perhaps by splitting the current monolithic plugin into multiple pieces that incrementally displays hostname, pwd, date/time, and adding a new piece that displays git branch in a nice way.

netj avatar Jul 09 '15 19:07 netj