Created
May 12, 2015 16:03
-
-
Save mattkenefick/80cefd2f6359794d92da to your computer and use it in GitHub Desktop.
giddyup
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
# 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