gitgithubwiki

How to integrate a GitHub wiki into the main project


I want keep all my source code and documentation in one single Git repository. I already have the GitHub pages integrated into my main project and now I want to do the same with the GitHub wiki.

I know that GitHub wikis are plain Git repositories. My plan is to add the wiki as a remote to my main repository and keep everything in one place. However in the wiki repository everything is in the root directory and thus would clutter my main project.

What is the best way to handle this?


Solution

  • You want to add the wiki as a submodule. The same Wiki Git repository connected as a remote, but within a subdirectory with its own .git directory.

    git submodule add git://github.com/you/proj.wiki
    

    In the root of your main repository to add the wiki repository as a submodule in the wiki/ directory.