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:
- Start by pulling down the latest changes from master
- Branch off to isolate the feature or bug-fix work in a branch
- Now you can work on the feature
- To keep your feature branch fresh and up to date with the latest changes in master, use rebase
- When ready for feedback push your branch remotely and create a pull request
- Perform a final rebase cleanup after the pull request has been approved
- 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.
- Simple Git workflow is simple - https://www.atlassian.com/blog/git/simple-git-workflow-simple
- Git Workflow Basics - https://medium.com/@igor_marques/git-workflow-basics-d405746f6205
- Code Review: An Agile Process - https://smartbear.com/learn/code-review/agile-code-review-process/