When I was developing this blog using Pelican, I faced a problem with git. As this blog is hosted by github pages and they serve the pages as static html file from master branch. Now, I also wanted to version the core code related to html page generation, for example, the theme and config files. I could not put them in the same git repo as Pelican generates static files in a directory inside the root blog directory called
output. According to github pages requirement, that has to be in the
So, I found a solution on
statckoverflow. The solution was to commit the code in two separate branches. I added all the core codes including
config files in a git branch called
core_code and I added all the static generated html, js, css files into
master branch of the same git repository.
First, I added a
.gitignore and added
output to it to make sure that when I added the all core Pelican code into
core_code branch, the generated static files in
output does not get added too.
Then I added and committed the code in root blog directory in the
$ git push origin core_code
Then go to the output directory, and commit it in the
$ git push origin master
When I clone the repo an another system, I just clone the
core_code branch first:
$ git clone -b core_code https://github.com/moshfiqur/moshfiqur.github.io.git
Then, go to the created git repo directory:
$ cd moshfiqur.github.io $ mkdir output $ cd output $ git clone -b master https://github.com/moshfiqur/moshfiqur.github.io.git .
That is how I maintain my blog code in a single repo and I can check them out in the same setup so that I can start using the code in any new system without much problem except of those related to installing Pelican.