Skip to content
This repository was archived by the owner on Oct 4, 2022. It is now read-only.

Commit 1aaf068

Browse files
committed
Add transfer-branch command
1 parent 8e4a3d2 commit 1aaf068

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"test": "lerna run test --stream",
1919
"install-ci": "lerna run install-ci",
2020
"link-all": "lerna exec yarn link",
21-
"unlink-all": "lerna exec yarn unlink"
21+
"unlink-all": "lerna exec yarn unlink",
22+
"transfer-branch": "./transfer-branch.sh"
2223
}
2324
}

transfer-branch.sh

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex;
4+
5+
PACKAGE=$1
6+
BASE_BRANCH=$2
7+
MERGING_BRANCH=$3
8+
9+
if [ -z "$MERGING_BRANCH" ]; then
10+
echo "Usage: yarn transfer-branch [package] [base-branch] [merging-branch]";
11+
exit 1;
12+
fi
13+
14+
case $PACKAGE in
15+
"yoastseo")
16+
ORIGINAL_REPOSITORY=https://github.com/Yoast/YoastSEO.js.git
17+
;;
18+
"yoast-components")
19+
ORIGINAL_REPOSITORY=https://github.com/Yoast/yoast-components.git
20+
;;
21+
esac
22+
23+
if [ -z "$ORIGINAL_REPOSITORY" ]; then
24+
echo "Error: Unknown package";
25+
exit 1;
26+
fi
27+
28+
echo $ORIGINAL_REPOSITORY;
29+
30+
git checkout $BASE_BRANCH
31+
git checkout -b $MERGING_BRANCH
32+
33+
git subtree pull --prefix=packages/$PACKAGE $ORIGINAL_REPOSITORY $MERGING_BRANCH

0 commit comments

Comments
 (0)