Last active
August 29, 2015 14:15
-
-
Save ahmedsbytes/f17e95259aeeb59c65bf to your computer and use it in GitHub Desktop.
My Git Command line short cuts
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
function ggs() | |
{ | |
git status | |
} | |
function ggp() | |
{ | |
git pull origin $(ggcb) | |
} | |
function ggpm() | |
{ | |
git pull origin master | |
} | |
function ggcb() | |
{ | |
git branch | grep '*' | sed -r 's/\*\ +//' | |
} | |
function ggsb() | |
{ | |
git stash | |
git checkout $* || ggsb $(ggcb) | |
for x in $( git stash list | grep $(ggcb) | awk -F: '{ print $1}' | sort -n -r ) | |
do | |
echo $x | |
git stash pop --apply $x | |
done | |
} | |
function ggcp() | |
{ | |
[[ $(ggcb) == 'master' ]] && echo "Not pushing to master , do it yourself baby" && return -1 | |
[[ -z $* ]] && echo "enter commit message" && return -1 | |
git commit -a -m "$*" || { echo "did not commit , so not pushing "; return $? } | |
git push -u origin $(ggcb) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice idea