4 ms·
What is "git prompt" and how do I turn it on? A quick search didn't reveal anything.
by hrjet 13y ago
What is "git prompt" and how do I turn it on? A quick search didn't reveal anything.
- riannucci 13y agoI think the parent is meaning something like the git-status integration of e.g. oh-my-zsh [0], or something like the 'official' git-status integration script for bash [1] (I've used the former, but not the latter.) [0] https://github.com/robbyrussell/oh-my-zsh https://github.com/robbyrussell/oh-my-zsh [1] https://raw.github.com/git/git/master/contrib/completion/git-prompt.sh https://raw.github.com/git/git/master/contrib/completion/git...
- matwood 13y agoAdd this to wherever you setup your bash prompt: source /usr/local/git/contrib/completion/git-prompt.sh source /usr/local/git/contrib/completion/git-completion.bash GIT_PS1_SHOWDIRTYSTATE=true export PS1='\u@\h \[\033[01;34m\]\w\[\033[00m\]$(__git_ps1 "\[\033[01;33m\](%s)\[\033[00m\]")$ ' source ~/.profile What this does is add a git style prompt anytime you are in a directory managed by git. On the prompt it will show your current branch, what state it is in (+'s/*'s show if you have changes), if your are merging/rebasing/cherry-picking/etc... The source files may live in slightly different places on your machine depending on where you installed git. This above also adds tab completion for git commands, branches, tags, etc... Also, see my .gitconfig for aliases I have put together from various places on the net: https://github.com/matwood/cfg/blob/master/.gitconfig https://github.com/matwood/cfg/blob/master/.gitconfig