DEV Community

Discussion on: Deploying to gh pages with git subtree

Collapse
 
maxwell_dev profile image
Max Antonucci

I've recently found out about this trick and it's helped me a lot as well! For one repo it makes it easy to save all our source files into a separate branch as a ruby gem, separate from everything else.

One obstacle I've encountered is that using subtree this way only works for files not being ignored by .gitignore. So using it with dist/ files I usually ignore (since they're just generated all the time) has made it hard to push it to gh-pages for that same repo. Have you found a way around this or just removed these areas from .gitignore?

Collapse
 
letsbsocial1 profile image
Maria Campbell • Edited

Hi Max, I don't ignore my dist. In fact, you are right. It can't be in the .gitignore, otherwise the command won't work. Can I ask what kind of project are you trying to use this for? Is it a project using a static website generator like jekyll, or is it a rails project? I use a commands that are similar in concept for my hugo generated site that might help you determine which way to go. There, I push the contents of my public directory to gh-pages, but public is in .gitignore. Here is the link to the repo of this website: github.com/interglobalmedia/interg... Feel free to take a look and see what is going on. I also wrote a post about how to deploy your Hugo generated website to gh-pages based on my workflow: interglobalmedianetwork.com/post/a... Hope it helps!

Collapse
 
maxwell_dev profile image
Max Antonucci

Sorry for the late response, but yes it is a Jekyll site. I've also hit a similar issue while using Pattern Lab, which is an open-source tool generating the public directory using Gulp. I tried to check the github link you shared, but it lead to a 404 page. But it is good to know how you've worked around this particular issue, I'll definitely give that post a closer look!

Thread Thread
 
letsbsocial1 profile image
Maria Campbell

Sorry for the bad link and for not getting back to you sooner. Was not bad, just did not have a space after it! Should work now. Hugo in terms of workflows is similar to Jekyll, especially since both use the public folder. Perhaps you can give the scripts I use for my Hugo site with Jekyll? And now you should be able to access the repo for inter-global media network blog. Let me know if this helps!

Collapse
 
letsbsocial1 profile image
Maria Campbell

And since you would have to repeat the script referred to in the Hugo article, you can create a script to basically automate the process like I did in the case of my React project in this article. I just haven't gotten around to finessing that process yet, but will eventually and then will write about it and share it here.