Skip to content

Instantly share code, notes, and snippets.

@ckarmann
Created November 29, 2013 19:55
Show Gist options
  • Save ckarmann/7711106 to your computer and use it in GitHub Desktop.
Save ckarmann/7711106 to your computer and use it in GitHub Desktop.
git config aliases
alias.unstage=reset HEAD --
alias.last=log -1 HEAD
alias.merge-to=!gitmergeto() { export tmp_branch=`git branch | grep '* ' | tr -d '* '` && git checkout $1 && git merge $tmp_branch && git checkout $tmp_branch; unset tmp_branch; }; gitmergeto
alias.st=status
alias.save=!gitsave() { git checkout -b $1 && git commit -am $1 && git checkout -; }; gitsave
alias.co=checkout
alias.tmpignore=!git update-index --assume-unchanged
alias.tmpunignore=!git update-index --no-assume-unchanged
alias.tmpignored=!git ls-files -v | grep ^[a-z]
alias.mylog=!git log --pretty=format:'%h|%an|%ad|%s' --date=local --since='2 weeks ago' | while IFS='|' read hash author date message; do printf '\e[m%s \e[1;31m%-20s \e[m%s \e[0;32m%s
alias.mylog2=!gitmylog2() { git log --no-merges --pretty=tformat:'%h|%an|%s' ..$1 | while IFS='|' read hash author message; do printf '\e[m%s \e[1;31m%-20s \e[0;32m%s
alias.mypull=!echo '*** FETCH' && git fetch && echo '*** LOG' && git mylog2 origin/master && echo '*** MERGE' && git merge origin/master
alias.mymerge=!gitmymerge(){ git mylog2 $1; git merge $1;}; gitmymerge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment