Skip to content

zmij/gitrc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

Initially found this script somewhere in the internet. Patched to work with different colors for clean branch, dirty branch, staged changes. For a clean branch the color is different if there are pending local or remote changes.

It looks like this:

gitrc

Installation

Place the .gitrc file to your home directory. Add the following code to your .bashrc or .profile file:

# uncomment this line if your startup script doesn't set color_prompt correctly
# color_prompt=yes
if [ -f ~/.gitrc ]; then
        . ~/.gitrc
fi

Automatically updating remote

The remote changes can be automatically updated. This can be a time consuming operation, so a reasonable update interval shoud be chosen. The feature is disabled by default and it can be set by

# Set remote update interval in seconds
git config --local prompt.updateinterval 60
# Or use a helper function
gitrc_refresh_timeout 60

To turn automatic remote update off

git config --local --unset prompt.updateinterval
# Or use a helper function
gitrc_refresh_timeout off