From be89ebd7a007473524357989c8632beda62d1792 Mon Sep 17 00:00:00 2001 From: Cassey Lottman <> Date: Thu, 19 Mar 2020 14:20:29 -0500 Subject: [PATCH 1/2] update update script --- sh/update.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sh/update.sh b/sh/update.sh index 84158f7..ceddf4f 100755 --- a/sh/update.sh +++ b/sh/update.sh @@ -1,6 +1,12 @@ #!/bin/bash # Updates the existing local and origin branches corresponding to the remix +# pass an argument if you want to pull a different branch name than the current branch you're on +# no argument needed to update against the branch name of the current branch -git checkout $1 -git pull $1 master -git push origin $1 \ No newline at end of file +current_branch="$(git rev-parse --abbrev-ref HEAD)" + +branchToUse="$1" && [[ -z "$1" ]] && branchToUse="$(git rev-parse --abbrev-ref HEAD)" + +git checkout $branchToUse +git pull $branchToUse master +git push origin $branchToUse \ No newline at end of file From 44b59f10be44724d8fb6b6fb410fbe7da0c7528e Mon Sep 17 00:00:00 2001 From: Cassey Lottman <> Date: Thu, 19 Mar 2020 14:25:39 -0500 Subject: [PATCH 2/2] clean up & comment --- sh/update.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sh/update.sh b/sh/update.sh index ceddf4f..9b5b952 100755 --- a/sh/update.sh +++ b/sh/update.sh @@ -3,8 +3,7 @@ # pass an argument if you want to pull a different branch name than the current branch you're on # no argument needed to update against the branch name of the current branch -current_branch="$(git rev-parse --abbrev-ref HEAD)" - +# branch to use is the first argument, but if the first argument was not passed, use the current git branch branchToUse="$1" && [[ -z "$1" ]] && branchToUse="$(git rev-parse --abbrev-ref HEAD)" git checkout $branchToUse