1

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?

John Smith
  • 45
  • 7

1 Answers1

0

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
    ....
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I'm not sure I totally understand what you're saying. Can you elaborate? – John Smith May 08 '14 at 17:14
  • @user2747911 I am saying a hook can help automate the process of updating several working trees, one per branch, in order for your web server to show them (under different url), depending on the view you want to show. The "update working tree" is the `git checkout` you see in the script I mention in http://stackoverflow.com/a/11323004/6309 – VonC May 08 '14 at 17:38
  • Thanks VonC, I like the idea of deploying these branches to different URLs. The --work-tree option is a little tricky, it's not documented on the git-checkout man page[1] and I think I was able to get it working once, but I'm mostly getting errors about that not being a valid option. – John Smith May 09 '14 at 20:13
  • @user2747911 "I'm mostly getting errors about that not being a valid option": that might be because `--work-tree` isn't an option of `git checkout`. It is an option of `git` (http://git-scm.com/docs/git). – VonC May 09 '14 at 21:48