简体   繁体   中英

Separate Git Deployments on a Single Server

I would like to have a feature in my application that allows a user to change between versions, specifically to see the differences in the application between sprints. The user would simply select a version (Sprint A, Sprint B, etc.) from a dropdown and the page would refresh, showing the state of the application at that time.

This itself shouldn't be too much of a problem. I think we'll have a Git deploy framework that will checkout the appropriate branch on the server.

The problem is I want to allow, for example, someone from business to be able to take a look at the application as of Sprint B, while a developer can give a demo of what he did for Sprint C at the same time, without one branch checkout clobbering the other.

Every time you change branches to view a version, it will affect everyone viewing that server.

Is there a way to allow one user to view another branch on the server without affecting anyone else, and possibly without making lasting changes to the files on that server?

I think we'll have a Git deploy framework that will checkout the appropriate branch on the server.

That is a good approach, but it need to checkout/update the appropriate branch in different folders (and your webapp need to redirect pages according to the user choice)

A post-receive hook is typically used in order to trigger a per-branch process: see for instance " how to process files on a branch in post-receive hook in git "

#!/bin/bash

while read oldrev newrev ref
do
  branch=`echo $ref | cut -d/ -f3`

  if [ "master" == "$branch" ]; then
    ....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM