mutistage deployment question...

Hello!

I apologize that I'm posting this here as it probably belongs in a git
group, but I figured this was a very standard Rails concern so here
goes...

I'm wondering what people do as best practices for when you have a
multi-staging environment and you have a feature that needs to "hop
over" the current test/stage environment?

Case in point. Let's say you have branch "master" as your main
repository branch. You have "staging" as your staging/testing branch.
And you have "production" as your live server branch. All are set up
as local branches and remote branches (with remote tracking).

So, let's say I work on a new feature (call it NewFeature) in a
branch, get it working, then merge (rebase?) it with "staging". Then
deploy the staging branch to the staging server for the test team to
test it.

Meanwhile, while that is happening, a critical bugfix comes in. So you
create that on a branch (call it BugFix), get it fixed, and then you
want to stage it for testing and then roll it out to production. But,
NewFeature is already on staging and it's not ready to roll out. I.e.
the BugFix needs to "leap over" NewFeature.

So what is the best way to handle this? Roll the staging branch back
to pre-NewFeature then merge the BugFix branch so that staging is pre-
NewFeature + BugFix? and then would you just merge (rebase? still
trying to understand the difference) Production + BugFix?

We currently lock deployment to the branches, meaning: deploying to
the staging server will pull from the staging branch only. And
likewise from production. Thus, I can't just merge BugFix +
Production, deploy to staging, then if all is well, deploy to
production. Perhaps this isn't the best setup?

Thoughts?

Thanks,

-Danimal