Fix git-setup.sh (#15560)
This commit is contained in:
1 parent
f38f98a0b6
commit
3fe26f19ff
1 file changed
+12
-5
+12
-5
@@ -2,7 +2,7 @@
|
|||||||
# If no project name is given
|
# If no project name is given
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
# Display usage and stop
|
# Display usage and stop
|
||||||
echo "Usage: git-setup.sh <console,website>"
|
echo "Usage: git-setup.sh <console,website,platform>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
# Get remote url to support either https or ssh
|
# Get remote url to support either https or ssh
|
||||||
@@ -21,11 +21,18 @@ for module in "$@"; do
|
|||||||
git config -f .gitmodules --unset-all "submodule.apps/$module.branch"
|
git config -f .gitmodules --unset-all "submodule.apps/$module.branch"
|
||||||
# Add the submodule
|
# Add the submodule
|
||||||
git submodule add --force $project "apps/$module"
|
git submodule add --force $project "apps/$module"
|
||||||
# Set the default branch to main
|
|
||||||
git config -f .gitmodules --add "submodule.apps/$module.branch" main
|
|
||||||
|
|
||||||
# Update to the latest from main in that submodule
|
# Determine the branch based on module
|
||||||
cd apps/$module && git pull origin main && cd ../..
|
branch="main"
|
||||||
|
if [ "$module" = "website" ]; then
|
||||||
|
branch="production"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set the default branch
|
||||||
|
git config -f .gitmodules --add "submodule.apps/$module.branch" ${branch}
|
||||||
|
|
||||||
|
# Update to the latest of branch in that submodule
|
||||||
|
cd apps/$module && git pull origin ${branch} && cd ../..
|
||||||
|
|
||||||
# We forcefully added the subdmoule which was in .gitignore, so unstage it.
|
# We forcefully added the subdmoule which was in .gitignore, so unstage it.
|
||||||
git restore --staged apps/$module
|
git restore --staged apps/$module
|
||||||
|
|||||||
Reference in new issue
Block a user