🔨 Update git helper scripts

This commit is contained in:
Scott Lahteine
2021-11-03 07:02:21 -05:00
committed by Scott Lahteine
parent 20c747753d
commit 5efef86cfa
6 changed files with 35 additions and 27 deletions

View File

@@ -1,19 +1,23 @@
#!/usr/bin/env bash
#
# mffp [1|2|3] [commit-id]
# mffp [1|2] [ref]
#
# Push the given commit (or HEAD) upstream immediately.
# By default: `git push upstream HEAD:bugfix-1.1.x`
# By default: `git push upstream HEAD:bugfix-2.0.x`
#
[[ $# < 3 && $1 != "-h" && $1 != "--help" ]] || { echo "usage: `basename $0` [1|2|3] [commit-id]" 1>&2 ; exit 1; }
usage() { echo "usage: `basename $0` [1|2] [ref]" 1>&2 }
if [[ $1 == '1' || $1 == '2' || $1 == '3' ]]; then
[[ $# < 3 && $1 != "-h" && $1 != "--help" ]] || { usage ; exit 1; }
if [[ $1 == '1' || $1 == '2' ]]; then
MFINFO=$(mfinfo "$1") || exit 1
REF=${2:-HEAD}
else
elif [[ $# == 1 ]]; then
MFINFO=$(mfinfo) || exit 1
REF=${1:-HEAD}
else
usage
fi
IFS=' ' read -a INFO <<< "$MFINFO"