DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Automating Developer Workflows and Deployments on Heroku and Salesforce
  • Look, Ma! No Pods!
  • Developer Git Commit Hygiene
  • Understanding Git

Trending

  • Teradata Performance and Skew Prevention Tips
  • AI's Dilemma: When to Retrain and When to Unlearn?
  • Rust and WebAssembly: Unlocking High-Performance Web Apps
  • Debugging Core Dump Files on Linux - A Detailed Guide
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. Git Strategies for Software Development: Part 1

Git Strategies for Software Development: Part 1

Learn strategies for working with the Git version control system to make developing and deploying your software faster and easier.

By 
Dharmendra Rathor user avatar
Dharmendra Rathor
·
Aug. 14, 18 · Tutorial
Likes (20)
Comment
Save
Tweet
Share
25.0K Views

Join the DZone community and get the full member experience.

Join For Free

Git is a version control system for tracking changes in files and coordinating work on those files among multiple people. It is primarily used for source code management in software development. It is a distributed revision control system and is very useful to support software development workflows.

The Git directory on every machine is a full repository which has full version tracking capabilities and independent of network access. You can maintain branches, perform merges, and continue with development even when you are not connected to the network. For me, having a full repository on my machine and ease of use (creating a branch, merging branches, and maintaining branching workflows) are the biggest advantages of Git. It is a free and open-source software distributed under the terms of the GNU.

I will try to cover two common strategies that can be used to support software development in two articles. In this article, I will cover the single release development Git strategy. A software team working on one release at a time usually uses this strategy.

Single Release Development Strategy

A software team working on one release at a time follows the following steps. I will try to add the git command/git UI steps to perform each step. The following diagram shows the strategy details:

Image title

Create a release branch from the production code branch “master.”

git checkout master
git checkout -b product-release1

The master has production code and “product-release1” is the new release branch.

Each dev member creates a feature branch from the release branch and works on feature development in that branch.

git checkout product-release1
git checkout -b product-release1-feature1

Each dev member has to work on the feature branch “product-release1-feature1.”

Everyone should take the latest updates from the release branch daily using the merge or rebase Git commands.

Let's say you are working on “product-release1-feature1” and you have to pull the latest changes form “product-release1.” This will make sure any changes that were moved to the release branch are available in the local feature branch. This also avoids conflicts or duplicate code while merging the feature branch to the release branch at feature completion time.

git merge product-release1
or
git rebase product-release1

Note: I would suggest using the merge option till you are very clear with  rebase.

Before doing this step, you should be only on your feature branch. Use the  “git branch” command to verify the branch name before doing a merge.

On completion of a feature, raise a pull request to merge the code to the release branch. This step can be done in the GitHub UI.

You can create and assign pull requests to a reviewer using the git UI. Refer to this link for the steps in the UI.

A code review will be performed on the pull request and changes will be done if needed. If everything is fine, the pull request will be approved by the reviewer. Refer to this link for the steps in the UI.

Create a tag from the release branch to the testing team for validation of the feature. We have to provide a tag to the testing team upon completion related features to be tested.

git tag -a product-release1_tag1 -m "product release1 tag1"

This should be done in the Git UI.

Upon completion of all features planned in the release, the final tag can be provided to the testing team for validation. 

Once testing is complete, a software production release will be done from the final QA approved tag.

After the production release, merge the release branch code to the master so that the master has the production code. This step can be done using the Git UI by raising a merge from the release branch to the master.

Next, delete the feature branch upon completion of the feature and delete the release branch upon completion of the release.

git branch -d product-release1-feature1
git branch -d product-release1

Any post-production release fix can be done in a tag. Remember to move the code to the master and post any production fix release.

git checkout -b  product-release1_prodfixticketNumber product-release1_tag1

This command creates a new branch, “product-release1_prodfixticketNumber,” from the production release tag “product-release1_tag1.”

Create the next release branch from the master, as the master has the production code, and follow the same approach for development as described above.

In this approach, the master branch has the production code and releases are done from a tag. Each dev member can cut a branch from the release branch, work on a feature independently, and upon completion of the feature, can raise a merge pull request and get it approved. While doing development, each dev member should rebase the code from the release branch so that they have the latest code.

This approach works fine for projects where a team is working on a single release at a time. Most teams are working on multiple releases at a time, so they have to maintain more than one release branch active at a time.

Please read the next article for a possible approach to handling projects working on multiple releases in parallel.

References

Useful git commands:

  • https://github.com/DharmendraRathor/gitCommands

  • https://gist.github.com/DharmendraRathor

GitHub Desktop tool: https://desktop.github.com/

Git Software development Release (computing) Branch (computer science) Production (computer science) master

Opinions expressed by DZone contributors are their own.

Related

  • Automating Developer Workflows and Deployments on Heroku and Salesforce
  • Look, Ma! No Pods!
  • Developer Git Commit Hygiene
  • Understanding Git

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!