Search
⌃K
Links

Git-Based Workflows

Overview

Before starting a collaborative project, it's important to establish a Git-based workflow to ensure that all team members are aligned on how changes will be applied.
Many workflows exist for projects that are managed by Git. To help you evaluate the best Git-based workflows for your project or team, here are some questions you should consider:
  • How comfortable is each individual on your team with the usage of Git?
  • Will additional training be needed to bring your full team up to speed?
  • Does the workflow you are considering scale with team/project size?
  • Is it easy to correct mistakes with your workflow?
  • Will your team deploy contributions into production as a single entity or will the features be deployed individually?

Centralized Workflow

One popular workflow is to designate a specific repository as the “central” repository.
The centralized workflow is the easiest workflow to adopt for teams new to Git. With this workflow, all team members make a local clone of the central repository. They are then able to edit files and make local commits without affecting the central repository. When a developer is ready, they can push all of their local commits to the central repository.
In this way, the central repository acts as a "source of truth" and single point for all changes to the project. Within the central repository is the main branch where all changes are committed to.
This workflow is best for smaller teams because each developer can work independently on their code without worrying about developments upstream.

Feature Branching

In feature branching, dedicated branches are used by developers to work on features without disturbing the main branch. Each branch is tied to a particular feature and is often denoted by clear and consistent naming. Developers can edit, commit, and perform pull requests on the branch until the feature is complete.
Since multiple developers may be working on the same feature, the feature branch should be pushed to the central repository. This provides both a remote backup of local changes and access to multiple team members who may be involved in the feature development.
This workflow caters to continuous integration (CI) environments because it ensures that the main branch will never be corrupted by broken code.