Last Updated: February 25, 2016
·
265
· ultrabenosaurus

Stick these two aliases in your .gitconfig to ease cleaning and updating your dev branches!

r = "!git remote prune origin; git clean -f -d; git checkout -- .; git pull"
update = "!f() { if [ $# -eq 0 ]; then bra=`git rev-parse --abbrev-ref HEAD`; else bra=$1; fi; st=`git stash -u | grep -o -e 'No local changes to save'`; git checkout master &> /dev/null; echo 'Switched to master.'; git r; git checkout ${bra} &> /dev/null; echo \"Back on ${bra}, beginning merge...\"; git merge origin/master &> /dev/null; git status; if [ \"\" == \"${st}\" ]; then echo 'Some files were stashed, use \"git stash apply\" to retrieve them.'; fi; }; f"