Git - Simple Workflow


A Git Workflow is a recipe or recommendation for how to use Git to accomplish work in a consistent and productive manner. Git workflows encourage users to leverage Git effectively and consistently. Git offers a lot of flexibility in how users manage changes. Given Git's focus on flexibility, there is no standardized process on how to interact with Git. When working with a team on a Git managed project, it’s important to make sure the team is all in agreement on how the flow of changes will be applied. To ensure the team is on the same page, an agreed upon Git workflow should be developed or selected. There are several publicized Git workflows that may be a good fit for your team. 1

For a small agile team, adapting a simple workflow is the best option; the following is an overview of a simple workflow with references to more detailed discussions. "Simple Git workflow is simple" details a seven-step process, with two main points.

  • master is always production-like and deployable
  • rebase during feature development, explicit (non fast-forward) merge when done

The seven steps are as follows:

  1. Start by pulling down the latest changes from master
  2. Branch off to isolate the feature or bug-fix work in a branch
  3. Now you can work on the feature
  4. To keep your feature branch fresh and up to date with the latest changes in master, use rebase
  5. When ready for feedback push your branch remotely and create a pull request
  6. Perform a final rebase cleanup after the pull request has been approved
  7. When development is complete record an explicit merge

Steps 5 and 6 facilitate a Code Review Process, "statistics prove that peer code review is one of the most effective ways to improve software quality by reducing defects upstream", but this a part of another discussion.