From d1126138f75605c6badbb4d7ffacc70bb4c6cb85 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Mon, 17 Aug 2015 15:16:20 -0700 Subject: [PATCH] add new git commands: open-in-github and push-feature-branch --- git-open-in-github | 10 ++++++++++ git-push-feature-branch | 13 +++++++++++++ 2 files changed, 23 insertions(+) create mode 100755 git-open-in-github create mode 100755 git-push-feature-branch diff --git a/git-open-in-github b/git-open-in-github new file mode 100755 index 0000000..843edd9 --- /dev/null +++ b/git-open-in-github @@ -0,0 +1,10 @@ +#!/bin/sh + +REMOTE="${1:-origin}" +BRANCH="${2:-$(git rev-parse --abbrev-ref HEAD)}" +REPO=$(git config --get remote.${REMOTE}.url | cut -d':' -f2 | cut -d'.' -f1) +if [[ -z "$REPO" ]] || [[ -z "$BRANCH" ]]; then + echo "usage: $(basename "$0") " + exit 1 +fi +open "https://github.com/${REPO}/compare/${BRANCH}?expand=1" diff --git a/git-push-feature-branch b/git-push-feature-branch new file mode 100755 index 0000000..01f2926 --- /dev/null +++ b/git-push-feature-branch @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e # bail on errors + +REMOTE="${1:-origin}" +BRANCH="${2:-$(git rev-parse --abbrev-ref HEAD)}" + +git update "$REMOTE" develop +git checkout develop +git merge --no-ff "$BRANCH" +git push +git checkout "$BRANCH" +git push -u "$REMOTE" "$BRANCH"