From 8b8f12283878071eda92745679e23de8b48e0c79 Mon Sep 17 00:00:00 2001 From: Charles OuGuo Date: Mon, 26 Feb 2024 14:25:38 -0500 Subject: [PATCH] Add script to merge repo (#10) --- scripts/merge-repo.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 scripts/merge-repo.sh diff --git a/scripts/merge-repo.sh b/scripts/merge-repo.sh new file mode 100755 index 00000000..3693ed74 --- /dev/null +++ b/scripts/merge-repo.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +set -euxo pipefail + +REPO=$1 +cd ~ +rm -rf $REPO +git clone https://github.com/shaldengeki/$REPO + +( + cd $REPO + time git filter-repo --to-subdirectory-filter $REPO +) + +( + cd ~/monorepo/ + git switch main + git remote add $REPO ../$REPO + git fetch $REPO --no-tags + EDITOR=true git merge --allow-unrelated-histories $REPO/main + git remote remove $REPO +)