From 323a70f5969862a6be01bb6ed872993edea6aa8f Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 7 Nov 2019 12:42:15 +0000 Subject: [PATCH] Add git-up command --- bin/git-up | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 bin/git-up diff --git a/bin/git-up b/bin/git-up new file mode 100755 index 0000000..79f3629 --- /dev/null +++ b/bin/git-up @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +# Usage: git up {branch} {remote} + +set -e + +if [[ $# < 1 ]]; then + echo "You must specify a branch name to update" + exit 1 +fi + +BRANCH=$1 +REMOTE=${2:-origin} + +git checkout ${BRANCH} && \ + git fetch ${REMOTE} && \ + echo && \ + git sl ${BRANCH}..${REMOTE}/${BRANCH} && \ + echo && \ + git pull --quiet && \ + git checkout -