Skip to content

Instantly share code, notes, and snippets.

@aweary
Created January 21, 2021 22:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aweary/57effb79fdeed5308d0e4b303e5743d6 to your computer and use it in GitHub Desktop.
Save aweary/57effb79fdeed5308d0e4b303e5743d6 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [ "$BRANCH" = 'master' ]
then
echo You must check out a feature branch first
exit 1
fi
if [ -z "$(git status --porcelain)" ]
then
echo There are no changes to commit
exit
fi
git add .
git commit
git push --set-upstream origin "$BRANCH"
# Replace {user} and {project} here
open "https://github.com/{user}/{project}/compare/$BRANCH?expand=1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment