I have a git repository for a web site, where the master branch represents production code. I have been asked to set up a 'sandbox' version of the site, for potential users of the system to experiment in so they don't have to do that in the production system.
Because the sandbox version of the site needs to be clearly labelled as such, and have some functionality disabled, I have created a sandbox branch (based off master) and made some commits there to add warning messages and so on.
I have then pushed both branches upstream, and on the web server I have checked out each branch in a separate directory - one for production and one for the sandbox.
This works fine, but the problem comes when I want to write more code. Once I commit the code to the master branch, it will be updated in the production system but the sandbox won't see the new code. So I rebase the sandbox branch onto master, so the commits for the sandbox always sit on top of production. But then of course once I've done that, I can no longer push the sandbox branch upstream because it's no longer a fast-forward. I have to log in to the git server, switch branches, do a soft reset then redo the push.
Surely there's a better way of doing this with git? What I really need is some way of consistently applying some commits on top of whatever branch is currently checked out.