Managing code and documentation in the same git directory structure

I submitted the project from Google Code to Github. This project contained in one directory structure both code and documentation.

I would like to use the functionality of the Github β€œPages” to host the html documentation. Ideally, I would like to make 1 push to commit code and documentation changes.

How can i achieve this?

+3
source share
1 answer

When it comes to GitHub pages , you have user pages and project pages.
I assume that you are talking about the latter, which means that you need to create your own gh-pages branch, copy the documentation files from the master branch to this new empty branch, as described on the GitHub document page.

From there, when you have new commits in both your master and gh-pages branches, you can push both branches with one click ( git push --all )

Problems begin when you absolutely want to see both directory structures at the same time.
The simplest solution:

  • one clone of your repo is installed in the master branches.
  • one clone (of the same repo) on branches of gh-pages.
  • symbolic link from the first repo to the second repo (which allows you to make changes to the code and the document in the same directory structure. Symbols are even supported on Windows with Vista).
  • a git alias script to automate the command sequence ' git push master origin; cd ../secondRepo; git push gh-pages origin git push master origin; cd ../secondRepo; git push gh-pages origin git push master origin; cd ../secondRepo; git push gh-pages origin '

You can try to get the doc repository as a submodule of your main repo, but ... it looks more complicated than it should: see " How to add git repo as a submodule? (Or: how to programmatically create GitHub pages?) ".


August 2016 Update: Simplified Publishing GitHub Pages now allows you to store your page files in subfolders (no more than gh-pages ):

Now you can select the source in the settings of your repository, and the GitHub pages will search for your content there.

Finally, you can update both codes and pages in the same branch.

+1
source

Source: https://habr.com/ru/post/1244269/


All Articles