A way to push arbitrary branches to beta servers when using git for deployment

611 Views Asked by At

If I'm currently using git for deployment, is there a way I can set up my beta servers so that they can have any branch pushed to their master branch for automatic post-receive checkout?

Example:

  1. A team member works on a feature branch on their workstation and gets it to a point where they'd like to test it on a beta server
  2. Team member commits their changes to the feature branch on their workstation

At this point, most of the tutorials I've seen for git-based deploy flows would have them somehow merge changes to a development branch. From there they would push the common development branch to the remote and the remote would checkout/pull it. Unfortunately, this commits development to every change they've made before they're necessarily ready for merge.

What I'm looking for is a way so that changes don't have to be merged to a development branch to be run on a beta. Instead, the branch in progress can be pushed directly to a consistent name that the beta server will always automatically check out without having to worry about messing up histories on the remote.

Would be interesting to hear alternatives to the solution found here: Use detached branch for deployment

1

There are 1 best solutions below

0
On

You could look into using Git tags. The developer can work on their branch like normal. Once they are happy with the code, tag the commit and push the tag to remote. The remote can checkout and build the tag instead of the branch.