I have a repository that contains the software in branch master
and its homepage in branch gh-pages
. The project contains an examples
directory with source files that should be contained in the master
branch. The homepage should contain the compiled examples and possibly also the source files. How can I share the examples (that depend on the master
branch to get compiled) between both branches? The desired workflow is:
$ git checkout gh-pages; ls examples/ # directory is empty $ git checkout master; ls examples/ # directory contains .tex source files author.tex $ make examples && ls examples/ # compiles .tex files to .png files author.tex author.png $ $MAGIC_COMMIT_TO_BRANCH_SELECTED_FILES gh-pages author.png author.tex $ git checkout gh-pages; ls examples/ author.tex author.png
Branch gh-pages
may already contain the examples so just switching to this branch will overwrite the newly compiled files. The compiled files should not be committed to the master
branch. I thought about creating another branch examples
but this does not really make it easier. If git submodule could point to specific branches (can they?) I could create an examples
branch that is used in the other branches as submodule. Moving the examples to another repository may work but I'd prefer to keep all in one repository. Maybe there is some merge manager or cherry-picking magic?