Skip to content

Instantly share code, notes, and snippets.

@trumbitta
Forked from henrik/.bashrc
Last active September 2, 2016 21:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save trumbitta/1405549 to your computer and use it in GitHub Desktop.
Save trumbitta/1405549 to your computer and use it in GitHub Desktop.
My version with tweaks and inspiration from holman/dotfiles
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GFh'
alias git=hub
alias gis="git status"
alias gits="git status"
alias gitp="git pull"
alias safepull="git stash && git pull && git stash apply"
alias dspurge="sudo find . -name \".DS_Store\" -depth -exec rm {} \;"
alias gituserme='git config user.name "William Ghelfi" && git config user.email trumbitta@gmail.com && cat .git/config | grep -C2 "[user]"'
alias gituserwilliam='git config user.name "William Ghelfi" && git config user.email william@williamghelfi.com && cat .git/config | grep -C2 "[user]"'
if [ -f /usr/local/Cellar/git/1.9.1/etc/bash_completion.d/git-prompt.sh ]; then
source /usr/local/Cellar/git/1.9.1/etc/bash_completion.d/git-prompt.sh
fi
if [ -f /usr/local/Cellar/git/1.9.1/etc/bash_completion.d/git-completion.bash ]; then
source /usr/local/Cellar/git/1.9.1/etc/bash_completion.d/git-completion.bash
fi
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_unpushed {
local unpushed=`/usr/bin/git cherry -v origin/$(get_git_branch)`
[[ "$unpushed" != "" ]] && echo "$(tput setaf 1) ++> $(tput sgr0)"
}
function parse_git_dirty {
git diff --quiet HEAD &>/dev/null
[[ $? == 1 ]] && echo " $(tput bold)$(tput setaf 3)*$(tput sgr0)"
}
function get_git_branch {
echo $(__git_ps1 "%s")
}
function parse_git_branch {
local branch=$(get_git_branch)
[[ $branch ]] && echo "[$(tput setaf 6)$branch$(tput sgr0)$(parse_git_dirty)]$(parse_git_unpushed)"
}
PS1='${debian_chroot:+($debian_chroot)}\u@\h \w$(parse_git_branch)\n$ '
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_unpushed {
local unpushed=`/usr/bin/git cherry -v origin/$(get_git_branch)`
[[ "$unpushed" != "" ]] && echo "$(tput setaf 1) ++> $(tput sgr0)"
}
function parse_git_dirty {
git diff --quiet HEAD &>/dev/null
[[ $? == 1 ]] && echo " $(tput bold)$(tput setaf 3)*$(tput sgr0)"
}
function get_git_branch {
echo $(__git_ps1 "%s")
}
function parse_git_branch {
local branch=$(get_git_branch)
[[ $branch ]] && echo "[$(tput setaf 6)$branch$(tput sgr0)$(parse_git_dirty)]$(parse_git_unpushed)"
}
PS1='${debian_chroot:+($debian_chroot)}\u@\h \w$(parse_git_branch)\n$ '
[user]
name = William Ghelfi
email = my@email.it
[github]
user = username
token = xyzverylong
[alias]
lol = log --graph --decorate --pretty=oneline --abbrev-commit
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[core]
excludesfile = /home/user/.gitignore_global
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment