Skip to content

Instantly share code, notes, and snippets.

@rjeschke
Created May 31, 2012 21:09
Show Gist options
  • Save rjeschke/2846318 to your computer and use it in GitHub Desktop.
Save rjeschke/2846318 to your computer and use it in GitHub Desktop.
Git-push-current-branch script with safety-net
#!/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