Skip to content

Instantly share code, notes, and snippets.

@andersonfraga
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andersonfraga/62114b389b21a1cdf3e0 to your computer and use it in GitHub Desktop.
Save andersonfraga/62114b389b21a1cdf3e0 to your computer and use it in GitHub Desktop.
# alias
alias la='ls -la --color=auto'
alias ..='cd ..'
alias .='pwd'
alias www='cd /www'
alias cntfiledir='ls -l | awk "!/^d/{print }" | wc -l'
alias g='git'
export PATH=$HOME/local/bin:$PATH
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
function gitdiffs() {
if [ ! -z "$2" ]
then
git log --left-right --graph --cherry-pick --oneline $1...$2 >> $1_$2.log
git diff $1 $2 >> $1_$2.diff
git diff --name-status $1..$2 >> $1_$2.files
fi
}
function gitsendto() {
if [ ! -z "$1" ]
then
git stash
git checkout $1
git stash pop
fi
}
function checkout() {
git pl
git checkout dev
git pl
git checkout master
git pl
git merge dev
git ps
git checkout dev
git merge master
git ps
if [ ! -z "$1" ]
then
git nbr $1
git ps
git checkout dev
fi
}
function updatebranch() {
CUR=`git cbr`
#git pull origin
git checkout dev
git pl
git checkout $CUR
git merge dev
}
function tlog() {
tail -f logs/app.$(date +'%Y%m%d').log
}
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
PS1="\[\033[0;33m\]\t\[\033[00m\] \[\033[0;32m\]${HOSTNAME}\[\033[00m\] \[\033[0;36m\]\w\[\033[00m\] \$(parse_git_branch)$ "
[alias]
l = log --graph --pretty=format':%C(yellow)%h%Cblue%d%Creset %s %C(white) %an, %ar%Creset'
lol = log --pretty=oneline --abbrev-commit --graph --decorate
s = status
c = !sh -c 'git commit -v --branch -am \"$1\"' -
cmp = !sh -c 'git commit -v --branch -am \"$1\" && git pl' -
trash = checkout --
cbr = !git rev-parse --abbrev-ref HEAD
pl = !git pull -v \"origin\" \"$(git cbr)\"
ps = !git push -v \"origin\" \"$(git cbr)\":\"$(git cbr)\"
plps = !git pl && git ps
ssb = !git status -s -b
sn = !git ssb -uno
lastcommit = !git rev-parse --verify HEAD
difflast = !git diff HEAD^ HEAD
rollback = !sh -c 'git reset --hard && git stash save --keep-index' -
rfile = !git reset HEAD
nbr = !git checkout -b
sendbr = !git push origin $(git cbr)
chp = !sh -c 'git checkout \"$1\" && git pl' -
[apply]
whitespace = warn
# https://github.com/diegoholiveira/dotfiles/blob/master/gitconfig
[color]
# turn on color
diff = auto
status = auto
branch = auto
interactive = auto
ui = auto
[color "branch"]
# good looking colors i copy/pasted from somewhere
current = green bold
local = green
remote = red bold
[color "diff"]
# good looking colors i copy/pasted from somewhere
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
# good looking colors i copy/pasted from somewhere
added = green bold
changed = yellow bold
untracked = red
[color "sh"]
branch = yellow
[help]
autocorrect = 1
[core]
autocrlf = false
safecrlf = true
[push]
default = simple
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment