0

I recently started to use git and I'm having an issue. For example, everyone recommends to use as much branches as possible, but how do I make visible multiple branches on a staging server for my client to review all changes I have done in a single go? I do know that I can merge back branches to development (and then into master for live deployment), but how can I deploy all branches under development, so that client can see all the changes at once? I did update post-receive code to move the actual code to proper working directory and it also switches to latest branch pushed, but that's not a solution, I want to see all of them and when the time comes for pushing to live, I should be able to select which ones to push and which ones not (clients sometimes do not like new features or changes done ...).

Any recommendations? Is git even capable of what I'm trying to achieve?

6
  • Have you considered using gerrit for this? Gerrit will get all the updates pushed to master (for example) and in gerrit you select which ones to actually merge. It seems similar to what you're looking for, or i misunderstand the question completely. Commented Feb 28, 2017 at 9:40
  • @Martin: will take a look at Gerrit, thank you. Commented Feb 28, 2017 at 10:37
  • @quetzalcoatl: I thought that git is exactly that ... A tool for managing development and workflow of it. Otherwise, why is it useful? I can have Google Drive that will act as a place to store my files. Commented Feb 28, 2017 at 10:42
  • Kristjan, no, it certainly is not for that. You can build a development workflow based on git, but git itself has nothing to do with it except for providing you some basic operations like branch or merge. But will "branch" create a new virtual machine for you? or will it tell John that he should work on that branch from now on? Nope. It will not. You can name that branch John-new-feature and rely on his intelligence, not git. You can write a post-whatever script that will connect VMWare and setup a new machine, but it will be your script, your tool. Not git. Commented Feb 28, 2017 at 11:13
  • Git will be just the base of it, and whatever you build upon it, is not git, it's your environment, tools, rules, conventions, etc. Git itself is a version control system that tracks files. Please check out i.e. en.wikipedia.org/wiki/Git please also check "Continuous Integration" and "Continuous Delivery" terms, look for tools that support it. I have a feeling that it will help you find answers and tools faster. I also have a feeling that you either already have a ton of scripts, or that you are using a 3rd party tool like Bamboo, but you didn't say it yet. Commented Feb 28, 2017 at 11:14

1 Answer 1

2

You can only have one branch checked out at a time in a single working copy of the repository.

The simplest approach to get what you want is probably to create a new branch for your test deployment, and merge each of the "feature branches" where you did your development to it.

That branch would contain all of the features that you choose to merge to it, so then you could push it to your staging server for testing.

Assuming that your stable code is in branch "master" and you want to test deployment of the changes in branches "feature1", "feature2" and "feature3" (and all of those were branched from master), and you have a remote set up called "staging" where you want to push to, something like this should work:

git checkout master
git checkout -b test_deployment
git merge feature1
git merge feature2
git merge feature3
git push staging test_deployment
Sign up to request clarification or add additional context in comments.

1 Comment

Thought so, but wasn't sure. Thank you for your comment!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.