From fc8cdb3ee4a845699c2358da48bb0cf9c5c8b82b Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 21 May 2021 22:56:18 +0100 Subject: [PATCH] git: Add create-new-tracking-branch command --- bin/git-create-new-tracking-branch | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 bin/git-create-new-tracking-branch diff --git a/bin/git-create-new-tracking-branch b/bin/git-create-new-tracking-branch new file mode 100755 index 0000000..0a14fb4 --- /dev/null +++ b/bin/git-create-new-tracking-branch @@ -0,0 +1,15 @@ +#!/bin/sh + +set -e + +if [ "$#" -lt 1 ]; then + echo "Error: Not enough arguments." + exit l +fi + +# Create a new branch including any additional arguments. +git checkout -b "$@" + +# Push the branch to origin, bypassing any Git hooks. +new_branch_name=$1 +git push --no-verify -u origin "${new_branch_name}:opd-${new_branch_name}"