Ask all your coding questions @ codequery.io

Git is a popular open source tool for version control. It allows developers to collaborate and make changes to a centralized code base without interfering or breaking the production code. While Git makes it possible for developers to simultaneously manage different features of a project, things can still get messy when a generalized workflow isn't established among team members. In this article, we discuss the different types of Git workflows and best practices for using Git with your development team.

What is Git

Git is a form of version control, which is really just a fancy term for keeping code organized. When you have a group of developers working on the same project, things can get messy fast. Let's say developer A makes changes to the same file as developer B. If both devs overwrite the same file then how do we know which file to use? What if we need both the changes from dev A and dev B in production but they are conflicting with one another?

These are the issues Git protects against. Git allows developers to have their own local copy of a central repository. With Git, developers "check out " versions of a master branch and then merge their changes back into the central repository.

By encapsulating developers' work into separate branches, devs can work on the same code base without constantly overwriting/conflicting other contributions.

Different Git Workflows

While branching off of a central repository prevents conflicts, there are specific strategies development teams can follow for knowing when to merge or sync up with the central repo. Below, we define four popular methods for Git workflow used today.

Centralized Workflow

A centralized workflow is the simplest form of Git workflow. Developers check out their own local copy of a centralized master branch. As the developer makes changes, he/she logs progress via commits (or a historical snapshot of the files changed on the local branch). Whenever a developer finishes a feature, he/she sim ply merges local work with the master branch.