Search code examples
gitgithub

How to maintain an 'offline' branch with Git/GitHub


I'm planning to use GitHub pages to create a blog, including writeups of CTFs. Due to the terms of these, the writeups cannot be released until a specific date. I'm planning to have a master branch that is the one published on the site, but I'd also like an offline branch containing unpublished writeups, which should never touch the remote until merged into master. Is there a way to do this using Git/GitHub?


Solution

    1. You could keep the offline branch in your local copy, and only push to the remote when you want to publish it. Alternatively, keep two remote copies, one public and one private. Use the private copy to maintain a remote backup of your code, and the public copy to publish your website. Push to the public copy only what you want, when appropriate for you.
    2. You could keep the GitHub repository that generates the web page private. Then, only the generated output using the code from the master branch will be publicly visible (as your web page). You can keep your private code in another branch in the remote and merge it with master when you wish to.