Created
January 26, 2021 09:04
-
-
Save phaistonian/f5f252a958e1539bac4d344bce365eac to your computer and use it in GitHub Desktop.
alias gpr="sh gpr.sh"
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/bash | |
set -e | |
BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
REMOTE=$(git remote get-url origin) | |
URL="$REMOTE/compare/$BRANCH?expand=1"; | |
if [ "$BRANCH" = "master" ] | |
then | |
echo You must checkout 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" | |
open "$URL" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment