Skip to content

Instantly share code, notes, and snippets.

@mattkenefick
Created May 12, 2015 16:03
Show Gist options
  • Save mattkenefick/80cefd2f6359794d92da to your computer and use it in GitHub Desktop.
Save mattkenefick/80cefd2f6359794d92da to your computer and use it in GitHub Desktop.
giddyup
# pulls current branch you're on
# commits any code if you add a string
# pushes committed code to branch you're on
#
# e.g.
# giddyup (pulls branch only)
# giddyup "My Message" (pulls, commits "My Message", pushes changes)
#
giddyup() {
branch=$(git branch 2> /dev/null | grep "*" | cut -d " " -f 2);
printf " \n"
printf "giddyup\n"
printf " Pull from \033[1;31m$branch\033[0m \n"
if [ ${#1} -gt 0 ]; then
printf " Committing \033[1;32m$1\033[0m\n"
printf " Pushing to \033[1;31m$branch\033[0m \n"
fi;
printf " \n"
printf " --------------------------------------------- \n"
git pull origin $branch;
if [ ${#1} -gt 0 ]; then
printf " --------------------------------------------- \n"
git commit -am "$1"
printf " --------------------------------------------- \n"
git push origin $branch;
fi;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment