Skip to content

Git

Tips and tricks about everyone's favorite version control system. Sometimes oddities, too.

Rendering your static website into a separate branch in a subdirectory

When you're using a static site generator, a common workflow is that you have a Git repo with your source documents, run the SSG on it, which will render your site's HTML into an output directory, and then you take that directory and push it to a separate branch (usually called pages) in the same directory.

But how do you switch branches, especially if you might have uncommitted changes? And how do you make the output subdirectory the top-level directory in the other branch?