View on GitHub

Docsync

Testing methods to sync README.md and other documentation selectively from master branch to gh-pages.

Download this project as a .zip file Download this project as a tar.gz file

docsync

This is an example project demonstrating how to setup an easy configuration for keeping your README.md automatically synced with a GitHub Pages project page created using one of the great layouts available when using GitHub's Automatic Page Generator.

Background

If you haven't set up a project page for your GitHub repository yet, then you can do so by following the instructions found here. GitHub will provide a great feature and just before you pick your layout it will give you the chance to load in your README.md for your master branch and edit it before using it as the content in the layout. The problem I had with this in my project's is that I wanted to use the README.md from my master branch, but I also wanted it so the project page to stay updated and in sync with the README.md automatically.

Relative Links

How to Easily Sync README.md to Project Page

This project contains a bash script which is used in your project as a git hook. Git has support for scripts to hook into and execute when certain actions are taken on a local git repository. If you create a bash script named post-commit and place it in the directory .git/hooks/ within your local repository, it will then be executed after every committ to that repository.

The post-commit script contained in this project is a bash script so you will need bash it in your path. If you are running Git on Windows, this is in bin subdirectory within your Git program files directory. In order to use the post-commit script here you must already have a project page created with one of the layouts using the Automatic Page Generator and have set it up using the following instructions:

That's it, now whenever you make a commit to the master branch, the README.md file and all the markdown in the docs directory of your master branch will be synced up with the will automatically be synced to your project page.