Skip to content

Instantly share code, notes, and snippets.

@caco26i
Last active February 5, 2023 04:23
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caco26i/f902bedcf886e5d907f016478db3495f to your computer and use it in GitHub Desktop.
Save caco26i/f902bedcf886e5d907f016478db3495f to your computer and use it in GitHub Desktop.
Create a Roots.io project working with Git Subtrees, Trellis, Bedrock, Sage
#change de URL of the repo
repo=<repo_url.git>
tools=(trellis bedrock sage) #tool from roots.io
subtrees=(trellis site site/web/app/themes/sage) #folder structure for the tools
#init repo
git init
git remote add origin ${repo}
touch .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 read-tree --prefix=${subtrees[$count]}/ -u ${tool}/master
git commit -m "add ${tool} subtree"
git push origin master
count=$(( $count + 1 ))
done
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment