Open In App

Git Workflows For Agile Development Teams

Last Updated : 01 Mar, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Git Flow is a branching model that involves the use of different types of branches based on the objective of the task.

GitFlow Workflow

GitFlow Workflow

The Git Flow strategy consists of the following branches

  1. Main: This branch is used for production deployment.
  2. Develop: New features are merged into this branch.
  3. Feature: A branch was created to develop a new feature.
  4. Release: This branch prepares code for a production release.
  5. Hotfix: A branch for critical production fixes.

Agile Development Lifecycle

Agile Development Lifecycle

Agile Development Lifecycle

The Agile Development Lifecycle is a series of phases that a project goes through right from planning to launch. One of the common approach of Agile Lifecycle is to work through sprints. A sprint can last from one to four week based on the project requirement and releases. Let’s have a look at the different stages of the Agile lifecycle.

  1. Plan/Requirement Gathering: This phase involves defining project goal, understanding the scope, plan and estimate the roadmap of the project.
  2. Design: The team will design wireframes/low fidelities to lay down the project architecture. The Product Owner works with the design team to incorporate the scope and finalise the theme of the user interface. This phase involves going back and forth to improve the user experience of the project.
  3. Development: The developers work on the assigned tasks based on the user stories created on each sprint. This includes code review, code quality and unit testing..
  4. Testing: At the end of every sprint, the QA team tests the entire scope of the user stories based on the defined acceptance criteria. This can also take place between the development phase based on how the builds are sent to the QA team. The Agile life cycle incorporates various types of testing including integration testing, acceptance testing, system testing, load and performance testing.
  5. Deployment: After successful testing, the product is deployed on the specific host/domain. This can be automated using CI/CD pipelines.
  6. Delivery/Release: Once the product is built, tested and reviewed internally, it’s prepared for launch.
  7. Maintenance: After every release, the launched product is reviewed to improvise based on user’s feedback.

Steps to Integrate Git In Your Agile Workflow

Let’s see above flow through an example.

To get started with GitFlow integration, make sure you have git flow installed on your machine. Run below command on Mac to install git-flow.

brew install git-flow-avh

Initialise Gitflow on your command line as below. Select the names of your production and release branches. You can also rename feature, bugfix, release, hotfix and support branches.

Initialise GitFlow

Initialise GitFlow

Now, let’s create a feature branch. Checkout at the development branch and execute the below command.

Create a feature branch

Create a feature branch

Add a file index.js and commit the file.

Create a commit on the feature branch

Create a commit on the feature branch

Once the feature is completed, execute below command to finish the feature branch. This command will merge the featured branch to development branch and delete it. You will be checked out at development branch.

Complete the feature branch

Complete the feature branch

Run git checkout -b release/0.1.0 to create a release branch. Once the changes are ready, merge them to main and develop. A hotfix branch needs to be created from the main branch and merged to both main and develop branch.

This workflow will be on every sprint of the Agile Development Life Cycle.

Choosing the Right Git Workflow

There are three types of Git Workflows to choose from:

  1. GitFlow: This workflow defines a structured set of branches to organise the development cycle. IT is suitable for projects with scheduled releases. The main branches include master, develop, feature, release and hotfix branches. Read more about this strategy at the start of this article.
  2. GitHub Flow: This is a simpler and lightweight workflows which includes main/master and feature or bugfix branch. The changes are approved and merged directly into the main branch and deployed to production.
  3. GitLab Flow: This workflow offers flexible and adaptable approach based on environment branches. The changes are merged to main branch and then to the specific environment branch as per requirement.

Choosing the right Git Workflow depends on your project structure and your team’s preferences and needs.

  • If you have a scheduled and strict releases, it’s better to follow a formal development process by using the Gitflow Workflow. This is suitable for complex projects.
  • If you have a smaller team and want to opt for a simplified process, GitHub Flow will be easier to learn and use.
  • If you want to prioritise flexibility, move ahead with the GitLab Workflow.

Benefits of Git for Agile Teams

  1. Task Git branch. During the sprint planning, the Product Owner, Product Manager along with the Development team decide the scope of the upcoming sprint along with the user stories. These user stories consist of tasks and sub-tasks which are allocated to developers. Consider each task as a Git branch.
  2. With the help of code review, each task – each branch can be reviewed separately which helps in maintaining code quality.
  3. Once the development phase of a branch is complete, it can move to the next stage of the Agile Life Cycle; testing. The developer can inform the QA team that a particular feature has finished and can be tested. This helps testers to start with their work without waiting for the entire sprint tasks to be completed.
  4. The DevOps team can set up automated tests – continuous integration or continuous delivery which can be executed after every merge.
  5. Using Git strategy gives an overall transparency to the team to identify the work done on any feature and even track the changes made for any releases, bug fix or hotfixes.

Frequently Asked Questions on the Git Workflows

What is git fetch vs git pull?

Git fetch retrieves changes from a remote repository to your local repository without merging them. In contrast, git pull not only retrieves the updates but also merges them in your active branch.

When do we use git stash?

Git stash temporarily stashes current changes without discarding them so that the developer can work on other tasks in the same or other branch. These changes can be fetched later using git stash pop.

How to resolve a merge conflict?

Open the merge conflicted file in your editor to have a better understanding and visualisation of the conflicted code. Determine what changes are required and discard the rest. Once the conflicts are resolved, merge them.

How to undo a commit without loosing the file?

Use git reset –soft HEAD~1 to roll back to previous commit state. This will save the file changes in the staging area.



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads