I’m pretty new to git, and don’t want to screw things up as this is already a live project in Github.
I have a theme repo with Sage 8 in it, and a custom plugin repo. I’d like to pull them together into one new site repo and keep the commit history for both if possible.
I found this gist. Is this the right way to do it? If I clone the two repos first and then combine the clones will the originals stay intact (incase I screw something up?)
Or is it better to turn the theme repo into the Trellis + Bedrock repo and just have the custom plugin repo as a dependency?
It sounds like you want to take an existing site with a Sage 8 theme + a custom plugin and use it with Trellis/Bedrock; I’d suggest creating a new repo, adding Trellis & Bedrock per https://roots.io/trellis/docs/installing-trellis/ then using the sub-tree merge on the Sage 8 repo. Keep the custom plugin separate and add it to your project via composer.json. The gist you linked looks fine though I’m by no means an expert on sub-tree merging, but in the end you’d do something like this:
I would either fork the sage repo, and clone the fork, if you want to keep it as a sub-tree (see the “Pulling In Updates” section at the end of the gist) or delete the remote from the new project ($ git remote remove sageRepo) once you’ve added it. Either way, that will let you avoid any changes to the originals. If you don’t fork the repo, and leave the remote, you could change the original (intentionally or otherwise) if you make changes and push them upstream.
$ git read-tree --prefix=site/web/themes/sageRepo -u sageRepo/master
puts the theme one directory too high - we want it in site/web/app/themes/sageRepo