Created
May 31, 2012 21:09
-
-
Save rjeschke/2846318 to your computer and use it in GitHub Desktop.
Git-push-current-branch script with safety-net
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
#!/bin/bash | |
branch="$(git symbolic-ref HEAD 2>/dev/null)"; | |
branch=${branch##refs/heads/}; | |
echo "Command: git push origin $branch"; | |
while true; do | |
read -p "Is this correct? [yn] " yn | |
case $yn in | |
[Yy]* ) break;; | |
[Nn]* ) exit;; | |
* ) echo "Please answer y(es) or n(o).";; | |
esac | |
done | |
git push origin $branch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment