Skip to content

Instantly share code, notes, and snippets.

@sheldonh
Created April 15, 2015 09:38
Show Gist options
  • Select an option

  • Save sheldonh/41d4422605d4909cd2de to your computer and use it in GitHub Desktop.

Select an option

Save sheldonh/41d4422605d4909cd2de to your computer and use it in GitHub Desktop.
bash git prompt on Fedora
if ! type __git_ps1 &> /dev/null && [ -e /usr/share/git-core/contrib/completion/git-prompt.sh ]; then
. /usr/share/git-core/contrib/completion/git-prompt.sh
fi
if type __git_ps1 &> /dev/null; then
export GIT_PS1_SHOWDIRTYSTATE=1
export GIT_PS1_SHOWUNTRACKEDFILES=1
export GIT_PS1_SHOWCOLORHINTS=1
export PROMPT_DIRTRIM=2
export PROMPT_COMMAND='__git_ps1 "\w" "\\\$ "'
fi
@yensei
Copy link

yensei commented Sep 11, 2021

If anyone like me wants to see the user and host just change PROMT_COMMAND with
export PROMPT_COMMAND='__git_ps1 "\u@\h\w" "\\\$ "'

@overGDev
Copy link

Thank you very much for this. I am new to Fedora and I was wondering how to configure this. Until now, I've been just using git branch before every single commit. This is much nicer.

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