Skip to content

Instantly share code, notes, and snippets.

@mkanenobu
Created May 14, 2018 00:52
Show Gist options
  • Save mkanenobu/e16ba1ae546425c11a57de84458b88be to your computer and use it in GitHub Desktop.
Save mkanenobu/e16ba1ae546425c11a57de84458b88be to your computer and use it in GitHub Desktop.
git push current branch
#!/bin/bash
current_branch="$(git branch | grep \* | sed -e "s/\*\ //")"
echo "Push to $current_branch"
if [ "$current_branch" = "master" ]; then
read -rp "Are you sure?:" confirm
if [ "$confirm" = "y" ]; then
git push origin master
else
echo ""
fi
else
git push origin "$current_branch"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment