command shell git branch display

This code example demonstrates Bash programming techniques and best practices.

parse_git_branch() {
    git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p'
}
export PS1=$PS1'$(parse_git_branch) '

Language: Bash
Original Source: BlogEngine.NET Migration
Code Lines: 16

ubuntu: 



command shell git branch display

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