Last active
June 14, 2016 11:01
-
-
Save kitingChris/e22f9f41f16d24f213a470ef31dc5367 to your computer and use it in GitHub Desktop.
This file contains 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
# enable color support of ls and also add handy aliases | |
if [ -x /usr/bin/dircolors ]; then | |
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" | |
alias ls='ls --color=auto' | |
#alias dir='dir --color=auto' | |
#alias vdir='vdir --color=auto' | |
alias grep='grep --color=auto' | |
alias fgrep='fgrep --color=auto' | |
alias egrep='egrep --color=auto' | |
fi | |
# some more ls aliases | |
alias ll='ls -alFh' | |
alias la='ls -A' | |
alias l='ls -CF' | |
alias ssh='TERM=xterm ssh' | |
alias fpm.ruby2.1='fpm' | |
# Add an "alert" alias for long running commands. Use like so: | |
# sleep 10; alert | |
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' | |
__has_parent_dir () { | |
# if pwd is root directory so not do anything | |
if [ "$PWD" == "/" ]; then | |
return 1; | |
fi | |
# Utility function so we can test for things like .git/.hg without firing up a | |
# separate process | |
test -d "$1" && return 0; | |
current="." | |
while [ ! "$current" -ef "$current/.." ]; do | |
if [ -d "$current/$1" ]; then | |
return 0; | |
fi | |
current="$current/.."; | |
done | |
return 1; | |
} | |
__vcs_name() { | |
if [ -d .svn ]; then | |
echo "[svn]"; | |
elif __has_parent_dir ".git"; then | |
echo "[$(__git_ps1 'git %s')]"; | |
elif __has_parent_dir ".hg"; then | |
echo "[hg $(hg branch)]" | |
fi | |
} | |
git-pull-all() { | |
cwb=$(git branch | grep -e "^*" | cut -c 3-) | |
for branch in $(git branch -r | cut -c 3- | grep ^origin\/ | grep -v \> | sed 's/origin\///g' ); do git checkout $branch; git pull; done | |
git checkout $cwb | |
} | |
git-prune-local() { | |
git fetch --prune && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment