Skip to content

how to incorporate git branch into bash terminal #1

@bongsoos

Description

@bongsoos

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 $"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions