Skip to content

Instantly share code, notes, and snippets.

@rafaelgfirmino
Last active June 6, 2017 14:05
Show Gist options
  • Save rafaelgfirmino/165f97f356a2d4faffebdb8aa54905d1 to your computer and use it in GitHub Desktop.
Save rafaelgfirmino/165f97f356a2d4faffebdb8aa54905d1 to your computer and use it in GitHub Desktop.

Mostrando a branch atual no terminal

Abra o bashrc no terminal e adicione as linhas a seguir;

function parse_git_dirty {
       test "$(git diff HEAD --name-only 2>/dev/null 2>&1)" && echo " *"
}

function git_branch_name() {
       git branch 2>/dev/null | grep -e '^*' | sed -E "s/^\* (.+)$/(\1$(parse_git_dirty))/"
}

function show_colored_git_branch_in_prompt() {
       PS1="\[\033[01;34m\]\w\[\033[31m\]\$(git_branch_name)\[\033[m\]$ "
}
show_colored_git_branch_in_prompt

OBS:Em algumas verões do linux mint o caminho do bach é /etc/bash.bashrc

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