Git – Using testing branches in Git

gitintegrationtesting

We have someone (let's call him Ted) that is responsible for testing new features and bug fixes.

We're using Git and GitHub. master should be/is always deployable and development is where we commit/merge new features or bug fixes, but only after they have been tested by Ted.

The project is in PHP.

I'd like the testing process to go like this:

  1. A developer wants to work on a new feature (let's say the feature/bug #123 as Ted documented in the issue tracker), so he pulls origin/development to development on his local repository and creates a new branch (let's say issue-123) from there.
  2. Once he's happy with his work, he commits and pushes his new branch to origin.
  3. Ted connects to test.ourproject.com/choose-branch and sees a list of the branches on origin and chooses to switch on issue-123 (it should be doable through the webpage). He then goes on test.ourproject.com, tests the hell out of the web application (he's really pitiless) and after some back and forth with the developer, he's happy with the feature.
  4. Ted tells the developer that he can merge issue-123 onto development on origin.
  5. Rinse and repeat.

For the third step, I could hack something that does the job (showing and switching branches from a specific page), but I feel that what I've described is a very common pattern.

So my question is:
Is this a good / sustainable / maintainable workflow for branching? Can you back up your answer by citing some examples of other projects following this workflow?

Best Answer

The branch workflow sounds a lot like gitflow http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow and there are support tools around it. It is highly recommended.

If there is only one tester, your testing workflow sounds fine, but if there are multiple people then development might move between start and finish, and of course testing should ideally be fully performed after any merge. This is where automated testing can really help or a slow (thorough) tester might never finish!

Another problem is that with many features and branches it becomes temping to mix and match features into a release (or to choose to evict after acceptance and merging) or perhaps if features are dependent on each other. The problem is if you start getting temped to rewrite history (rebase/delete a commit or merge) on a PUBLISHED branch-meaning one which has been pushed to a multidev repo. This is rewriting public history. It can be done for good or evil and even if done for good can cause problems to the unwary, and best practice is to avoid it so the question will never come up. However, some integration branch workflows make this very tempting, so if you have strong protection on such branches (eg gitolite per user branch restrictions) and people expect such activity so always rebase their code on such a branch, proceed--with caution!

I'd also like to recommend reading http://sethrobertson.github.com/GitBestPractices/ which discusses all of these matters and has many good references.