简体   繁体   中英

Github wiki and tags

So I have a Github project with a wiki I use to maintain the documentation. Every time something changes in the project or gets added to it, which is bloody often, I document it in the wiki immediately, which helps keep everything documented.

At the same time, most users only get and use periodic binary updates, and therefore need access to the state of the wiki at specific points in time. I know the wiki is a git repository as well, but it is apparently completely separate from the main project repository.

I also know it is possible to integrate the wiki repository as a submodule (though I can't say I understand how those work, as I don't really have commandline git experience) but that by itself does not answer my question, which I formulate this way:

What do I have to do to produce an URL I could just post for the users to direct them to a working wiki, reflecting it's state at the moment of the latest binary release?

I also know it is possible to integrate the wiki repository as a submodule (though I can't say I understand how those work, as I don't really have commandline git experience), but that by itself does not answer my question

It actually could answer the question, since a submodule will record the exact SHA1 of the wiki ( registered as a submodule )

cd /yourRepo
git submodule add -b master https://github.com/you/proj.wiki
git submodule update --init

Each time you modify your project, you can:

  • go to that submodule,
  • modify the wiki, add, commit and push,
  • go back to the parent repo, add, commit and push: that will record the SHA1 of the wiki in your parent repo.

When your users get that repo, a simple git ls-tree master:<path-to-directory-containing-submodule> can give them the SHA1 of that wiki.
Note that the content of that wiki wouldn't be visible unless those users were to make a:

git submodule update --init

But if that want only the SHA1, in order to access the wiki at https://github.com/you/proj.wiki/commit/<SHA1> , git ls-tree is enough (they don't need to populate the submodule with any content).


Now, if the submodule approach seems too cumbersome, you could more simply setup a pre-commit hook in your local repo, which would:

  • check the SHA1 of the latest commit in your wiki
  • put that SHA1 in a file within your local repo (as an url: https://github.com/you/proj.wiki/commit/<SHA1> )
  • reject the current commit, asking you to add and commit again (since a pre-commit cannot modify the index)

That way, your user would consult that file in order to get the wiki at the right version.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM