How to achieve a good git workflow


For a while, I've been trying to figure out a better git workflow. When I first started coding, version control wasn't a mandatory thing yet. It is something I learned along the way. I could not imagine a world without it now.

When you work in a team, a few people might end up working on the same project at the same time, on different features. Most of the time, some features will have to be approved before going live. In the meantime, you have this bug fix that needs to go live straight away. How do you solve this? By implementing the right version control workflow.

We've been working with branches for some time, and itseems to function pretty well:

  • master: The branch that is live. At anytime, whatever is commited on that branch is good to go live.
  • develop: The branch to get approval. Whatever is commited here is good to be shown and is waiting for approval, before getting merged in master.
  • feature branch: A branch for a specific feature, that only gets merged in develop when it's ready to be shown.

Now we rarely have any problems at all. No more amends that go live when they are not supposed to, no more dramatic git merge, we can focus on our code instead.