Reputation: 298176
I have a repository on GitHub that has two branches, namely master
and gh-pages
. The master
branch is basically a static website, but I use GitHub pages to have a project page with a "demo" button that lets the user see what the interface looks like. The project is a LightDM greeter theme, which can be run in the browser as well as by LightDM's Webkit greeter.
Only gh-pages
can serve the HTML to the browser normally, but I keep all my work on the master
branch.
My file structure is like this:
.
├── theme (master)
| ├── index.html
| └── ...
└── website (gh-pages)
├── demo -> contents of ../theme/
├── index.html
└── ...
I tried symlinking demo
to theme
, as the two must contain the exact same contents, but Git responds with this error:
Project/website [ git commit -a "Made some changes"
fatal: 'demo/' is beyond a symbolic link
Next, I made hooks that synced the contents of theme
and demo
whenever I made a commit on either of the branches, but this method seems unnaturally complicated.
I'm basically trying to keep theme
and demo
linked to one another. Is there a clean way of doing this using Git?
Upvotes: 1
Views: 1385
Reputation: 1324278
I think the symlink is the cleanest solution, except:
beyond a symbolic link
" error)The problem with hooks is that there aren't cloned around, so the user would still have to activate that specific hook.
Plus that may conflict with an existing post-checkout hook a user might have.
Another solution that won't conflict with any existing hook (but which will still need to be activated by said user cloning your repo) is a content filter driver:
When looking at the recognizable content of a specific file within website
, you can decide to create that symlink.
The idea is that a content filter driver script (here a 'smudge' script) is something you can register in a .gitattributes
file.
But the user will still need to declare that filter driver in his/her git config.
Upvotes: 1