1

I have a personal project on Github. My main documentation is a bunch of text files in my master branch, and I automatically generate some HTML pages from them. Github keeps the webpage for the repo in a separate branch called gh-pages. I want that page to refer my generated html files. Is it possible to hardlink/import a file on an another branch, so that when I change my docs in master and rebiuld the html files, gh-pages branch is also up to date?

Atilla Filiz
  • 2,383
  • 8
  • 29
  • 47

3 Answers3

2

You have two different points here:

  • first, auto-generated files have to be put into the git repository.
  • second, you want to have them in another branch.

My take would be to have two local repositories tracking both branches (master and gh-pages), and let your generating process put the generated files from master into the working directory of gh-pages. Then use a series of git add, git commit and git push in the second repository to have the online gh-pages updated.


Actually, I just tried this, with not two complete local repositories, but one repository with two working directories, using git-new-workdir. Then a symlink (not versioned, but ignored) from master/javadoc to gh-pages/javadoc), to create the documentation at the right location.

(The result is my jsch-documentation repository.)

Community
  • 1
  • 1
Paŭlo Ebermann
  • 73,284
  • 20
  • 146
  • 210
1

You'll need to manually track the files from the master branch to the gh-pages branch. But this should be simple to do by writing a quick script around either ''git merge'' or more likely ''git cherry-pick'' that you can run immediately after committing your changes to master.

Wes Hardaker
  • 21,735
  • 2
  • 38
  • 69
0

Or you can use a submodule and check out the desired version of the submodule.

Also if you don't mind writing a little script you can do a clean/smudge filter that will expand a kind of 'keywords' in your sources with the actual reference values you need automatically on checkout/checkin

See http://progit.org/book/ch7-2.html (man gitattributes); Not to sure whether github allows you to execute any hooks or attibute filters. Check their FAQ, I suppose

sehe
  • 374,641
  • 47
  • 450
  • 633