Last active
November 15, 2021 14:09
-
-
Save koraysels/ccd0cce8e13030233b848345dd7698d3 to your computer and use it in GitHub Desktop.
Create a trellis project from existing bedrock repos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#change de URL of the repo | |
deployRepo=https://github.com/undefinedio/deveerman-trellis.git | |
bedrockRepo=https://github.com/undefinedio/deveerman-backend.git | |
tools=(trellis) #tool from roots.io | |
subtrees=(trellis) #folder structure for the tools | |
#init repo | |
git init | |
git remote add origin ${deployRepo} | |
touch .gitignore | |
echo "/create_trellis_project.sh" > .gitignore | |
echo "/.DS_Store" > .gitignore | |
echo "/.idea" > .gitignore | |
git add . | |
git commit -m "initial commit" | |
#create the project | |
count=0 | |
for tool in ${tools[@]}; do | |
git remote add ${tool} https://github.com/roots/${tool}.git | |
git fetch ${tool} | |
git checkout -b ${tool} ${tool}/master | |
git checkout master | |
git subtree add --prefix=${subtrees[$count]} ${tool} master --squash | |
git commit -m "add ${tool} subtree" | |
# git push origin master | |
count=$(( $count + 1 )) | |
done | |
git remote add site ${bedrockRepo} | |
git fetch site | |
git stash | |
git checkout -b site site/master | |
git checkout master | |
git subtree add --prefix=site site master --squash | |
git commit -m "add site subtree" | |
EOF | |
# update subtree for the site | |
# git subtree pull --prefix=site/ site master --squash | |
# Later, if you want to see how your trellis differs from the latest main branch, | |
# git fetch trellis master | |
# git diff trellis/master HEAD:trellis --name-status |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment