Project

General

Profile

Actions

Useful git configuration settings

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

[user]
        name = Your Name
        email = your@email.net
[color]
        ui = true
[core]
        editor = vim
[fetch]
        prune = true
[merge]
        tool = meld
[mergetool]
        keepBackup = false
[status]
        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 8 months ago · 1 revisions

Also available in: PDF HTML TXT