Last active
December 17, 2015 22:09
-
-
Save tgvashworth/5680243 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/bin/sh | |
| # Commit and sync to Github | |
| # To install, run: | |
| # cd /usr/local/bin && wget -O commit-and-sync https://gist.github.com/phuu/5680243/raw/gistfile1.sh && chmod u+x commit-and-sync | |
| # then restart yaw terminals. | |
| BRANCH="$(git symbolic-ref HEAD 2>/dev/null)" | |
| # Reconnaissance | |
| echo | |
| echo " Commit and sync to GitHub" | |
| echo | |
| echo " Which remote? Your options are:" | |
| echo | |
| git remote | |
| echo | |
| read -p " Remote name : " -r REMOTE | |
| read -p " Commit message : " -r MSG | |
| # Make sure all is well | |
| echo | |
| echo " Ok." | |
| echo | |
| echo " Committing all changes, pulling from $REMOTE, and pushing." | |
| read -p " Happy? [y/N] : " -r | |
| if [[ $REPLY =~ ^[Yy]$ ]] | |
| then | |
| echo | |
| echo " Here we go..." | |
| echo | |
| git add -A && | |
| git commit -m $MSG && | |
| git pull $REMOTE $BRANCH && | |
| git push $REMOTE $BRANCH | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment