Skip to content

Commit 0be9873

Browse files
Fix git-setup.sh (#15560)
1 parent effda3f commit 0be9873

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

git-setup.sh

+12-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# If no project name is given
33
if [ $# -eq 0 ]; then
44
# Display usage and stop
5-
echo "Usage: git-setup.sh <console,website>"
5+
echo "Usage: git-setup.sh <console,website,platform>"
66
exit 1
77
fi
88
# Get remote url to support either https or ssh
@@ -21,11 +21,18 @@ for module in "$@"; do
2121
git config -f .gitmodules --unset-all "submodule.apps/$module.branch"
2222
# Add the submodule
2323
git submodule add --force $project "apps/$module"
24-
# Set the default branch to main
25-
git config -f .gitmodules --add "submodule.apps/$module.branch" main
2624

27-
# Update to the latest from main in that submodule
28-
cd apps/$module && git pull origin main && cd ../..
25+
# Determine the branch based on module
26+
branch="main"
27+
if [ "$module" = "website" ]; then
28+
branch="production"
29+
fi
30+
31+
# Set the default branch
32+
git config -f .gitmodules --add "submodule.apps/$module.branch" ${branch}
33+
34+
# Update to the latest of branch in that submodule
35+
cd apps/$module && git pull origin ${branch} && cd ../..
2936

3037
# We forcefully added the subdmoule which was in .gitignore, so unstage it.
3138
git restore --staged apps/$module

0 commit comments

Comments
 (0)