Created
May 20, 2014 07:10
-
-
Save acirtautas/fe371f19211a7dd43fca to your computer and use it in GitHub Desktop.
Git linux configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .bashrc | |
# Source global definitions | |
if [ -f /etc/bashrc ]; then | |
. /etc/bashrc | |
fi | |
# User specific aliases and functions | |
# current git branch for prompt below | |
# http://techblog.floorplanner.com/2008/12/14/working-with-git-branches/ | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\[\1\]/' | |
} | |
# has current branch unrecorded changes? | |
# http://markelikalderon.com/2009/01/16/dirty-prompts/ | |
parse_git_dirty() { | |
git diff --quiet HEAD &>/dev/null | |
[[ $? == 1 ]] && echo "*" | |
} | |
RED="\[\033[0;31m\]" | |
YELLOW="\[\033[0;33m\]" | |
GREEN="\[\033[0;32m\]" | |
WHITE="\[\033[0;37m\]" | |
PS1="$GREEN\u@\h $YELLOW\w \$(parse_git_branch)$RED\$(parse_git_dirty)$WHITE\n\$ " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
st = status | |
ci = commit | |
co = checkout | |
br = branch | |
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative | |
undelete = !git checkout $(git rev-list -n 1 HEAD -- "$1") -- "$1" | |
[color] | |
ui = true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment