Skip to content

Instantly share code, notes, and snippets.

@phaistonian
Created January 26, 2021 09:04
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phaistonian/f5f252a958e1539bac4d344bce365eac to your computer and use it in GitHub Desktop.
Save phaistonian/f5f252a958e1539bac4d344bce365eac to your computer and use it in GitHub Desktop.
alias gpr="sh gpr.sh"
#! /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