What is a good git workflow for TDD?

Viewed 5469

I quite like Gitflow branching model

but I'm not sure where to put the TDD cycle - should I simply use a feature branch and commit everytime I either wrote or passed a test (plus after refactoring)? Create a sub-branch and merge "finished" units into the feature branch? Should I commit each failing test or only after having it made pass?

Here's what I currently do, on a feature branch:

  1. Write a test, commit
  2. The test may yield errors due to non-existing interfaces, fix this, amend commit
  3. Make the (now only failing) test pass, amend commit
  4. Refactor, new commit
  5. goto 1
5 Answers
Related