From 728ee46fa8de05f7653fb2ef6c7338bc73db0afe Mon Sep 17 00:00:00 2001 From: Sammy Hori Date: Fri, 18 Oct 2024 23:29:39 +0100 Subject: [PATCH] Added tool for copying other repositories branches to this repository --- make-branch.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 make-branch.sh diff --git a/make-branch.sh b/make-branch.sh new file mode 100755 index 0000000..ceb9404 --- /dev/null +++ b/make-branch.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -euof pipefail + +profilename="$1" +projectname="awesome-for-beginners" +branchname="${2:-main}" + +fullname="${profilename}/${branchname}" + +branchname="${fullname}-branch-copy" + +git checkout main +git checkout -b "${branchname}" +git remote add "${profilename}" "https://github.com/${profilename}/awesome-for-beginners.git" +git fetch "${profilename}" +git merge --no-gpg "${fullname}" -m "Merge ${fullname} into ${branchname}" +git remote remove "${profilename}" +git fetch --prune +git push --set-upstream origin "${branchname}" +git checkout main