Skip to content

how to incorporate git branch into bash terminal #1

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

Activity

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

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