Skip to content

Instantly share code, notes, and snippets.

@ahmedsbytes
Last active August 29, 2015 14:15
Show Gist options
  • Save ahmedsbytes/f17e95259aeeb59c65bf to your computer and use it in GitHub Desktop.
Save ahmedsbytes/f17e95259aeeb59c65bf to your computer and use it in GitHub Desktop.
My Git Command line short cuts
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)
}
@mgomma
Copy link

mgomma commented Feb 19, 2015

Nice idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment