Skip to content

Instantly share code, notes, and snippets.

@irazasyed
Created July 12, 2013 20:49
Show Gist options
  • Save irazasyed/5987732 to your computer and use it in GitHub Desktop.
Save irazasyed/5987732 to your computer and use it in GitHub Desktop.
# Git Flow completion
complete -F _git_flow gf
complete -F __git_flow_feature feature
complete -F __git_flow_release release
complete -F __git_flow_hotfix hotfix
#...
[color]
ui = true
[alias]
panic = !tar cvf ../git_panic.tar . # Tar git local repository to parent folder
st = status
co = checkout
ci = commit
cs = commit -s
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
# display a pretty formatted log
# file backup function
bu () {
cp $1 `basename $1`-`date +%Y%m%d%H%M`.backup ;
}
# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoredups
# extract any file
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
# Make a dir and cd into
mkcd() {
if [ $# != 1 ]; then
echo "Usage: mkcd <dir>"
else
mkdir -p $1 && cd $1
fi
}
# This function gets current git branch
function parse_git_branch {
brs=$(git branch 2>/dev/null | grep '^*' | colrm 1 2) || return
if [ -z "$brs" ]
then echo ""
else echo "⌥ $brs"
fi
}
# Properly reset console output color if you type with a custom color
trap 'echo -ne "\033[0m"' DEBUG
# color defines
CYAN="\[\e[0;36m\]"
BLUE="\[\e[0;34m\]"
RED="\[\e[0;31m\]"
GREEN="\[\e[0;32m\]"
PS1="$BLUE\W:$RED\$(parse_git_branch) $GREEN\$ "
#username@hostname as tab title
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}\007"'
# aliases
alias ll='ls -la'
alias cd..='cd ..'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
# git flow aliases
alias gf='git flow'
alias feature='git flow feature'
alias release='git flow release'
alias hotfix='git flow hotfix'
# MacPorts Installer addition on 2011-08-23_at_17:02:51:
# adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
# Enable colors in terminal
export CLICOLOR=1;
# This loads RVM into a shell session.
[[ -s "/Users/MrCloud/.rvm/scripts/rvm" ]] && source "/Users/MrCloud/.rvm/scripts/rvm"
# Loads git and git flow completions
source ~/.git-completion.bash
source ~/.git-flow-completion.bash
# loads bash_completion from the system, this file also loads user's .bash_completion file
if [ -f /opt/local/etc/bash_completion ]; then
. /opt/local/etc/bash_completion
fi
set background=dark
colorscheme ir_black
syntax on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment