Useful git configuration settings

These options can be configured in your global git config file e.g. ~/.gitconfig on Linux:

        name = Your Name
        email =
        ui = true
        editor = vim
        prune = true
        tool = meld
        keepBackup = false
        rebase = false
        showUntrackedFiles = all

Or using shell commands e.g.

git config --global fetch.prune true

Prompt with branch and dirty indicator

vim ~/.bashrc

function parse_git_dirty {
    [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" 
function parse_git_branch {
    git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" 
PS1='\[\e[1;34m\]\u@\h:\w\[\e[0;32m\]$(parse_git_branch)\[\e[1;34m\]\$ \[\e[m\]'

Updated by Alexander Watzinger over 2 years ago · 2 revisions

Also available in: PDF HTML TXT