Last Updated: May 15, 2019
·
3.051K
· leemachin

Sync documentation between source and wiki on Github

You might have a doc folder in your project, full of documentation you maintain as you work on it.

You might also have a wiki on github with even more documentation, that isn't in the source (or documentation in the source that isn't in the wiki).

You can keep them in sync with Git, and Github is smart enough to know:

# change 'docs' at the end to whatever... or just omit it
git submodule add git@github.com:USER/REPO.wiki.git docs

Copy your other docs into the submodule repo, if you want, and then commit and push. Wiki updated!

You can't access the wiki repo directly, like you can your own. However, when you try to navigate to it in the source tree on Github, it'll take you straight to the wiki.

The end result is documentation that sits inside your working copy for offline reference, that can easily be synced with the wiki, and vice versa.

It also means potential users always see an up-to-date wiki, without having to clone the repo to get at the real documentation.

3 Responses
Add your response

Awesome idea!

over 1 year ago ·

This is also a great use case for the subtree alternative to Git Submodules (since submodules are often a pain during merge/rebase).
http://git-scm.com/book/en/Git-Tools-Subtree-Merging

git remote add docs git@github.com:USER/REPO.wiki.git
git fetch docs
git checkout -b docs docs/master
git read-tree --prefix=docs/ -u docs
over 1 year ago ·

@twolfson nice addition with a subtree example

over 1 year ago ·