Working with Git Hotfix Branches

Working with Git Hotfix Branches

Working with Git Hotfix Branches. Hotfix branches are created to fix specific bugs in production environment which were introduced after deploying previous release branches. The main difference between hotfix and release branch is, hotfix branch branches off from master branch so it ignores everything.

Hotfix branches are created to fix specific bugs in production environment which were introduced after deploying previous release branches. The main difference between hotfix and release branch is, hotfix branch branches off from master branch so it ignores everything (new features, code modifications, fixes, new files etc.) in develop branch. After finishing hotfix branches, they get merged back into develop and master branches so as a result both of these branches will have the fix immediately. We will see that below.

  • May branch off from master.

  • Must merge back into develop and master.

  • Branch naming convention is hotfix/x-x-x. The x[major release]-x[release]-x[hot-fix] signs represent the hotfix tag. e.g. If the current tag in your repository is "0.1.4" then your next tag will be "0.1.5" for hotfix branch. The one at the end gets bumped up by "1" so our new hotfix branch name should be hotfix/0.1.5. Next one will be hotfix/0.1.6.

When working with hotfix branches, you should open up a "pull request" in GitHub so that your team members can see what you're preparing to fix. This is considered as the best practise!

Create hotfix branch

Step 1

Check the current git status. As you can see below, master branch is behind develop branch at the moment.

Step 2

Create a hotfix branch that branches off of local master branch and tracks origin/master.

Step 3

Fix the bug and commit to it.

Step 4

Push hotfix branch to remote repository.

Step 5

If you go to GitHub, there will be a notification bar that will ask you to open a new "pull request" for the hotfix branch you've just pushed. 

Step 6

At this point "peer review" takes place against the "pull request" in GitHub. 

Step 7

Checkout into master branch.

git

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Best Practices for Using Git

Git has become ubiquitous as the preferred version control system (VCS) used by developers. Using Git adds immense value especially for engineering teams where several developers work together since it becomes critical to have a system of integrating everyone's code reliably.

7 Best Practices in GIT for Your Code Quality

Git plays a significant role in software development. It allows developers to work on the same code base at the same time. Check out 7 best practices for Git.There is no doubt that Git plays a significant role in software development. It allows developers to work on the same code base at the same time. Still, developers struggle for code quality.

Git Commands You Can Use To Dig Through Your Git History

Git Commands You Can Use To Dig Through Your Git History. In this short article, we’ll be exploring some quick git commands that can help us in digging through our repositories’ history of commits.

Git Rebase Tutorial and Comparison with Git Merge

In this article, I will explain to you a few differences between git merge, git rebase, and the git interactive rebase.I will tell a bit about what pros...

Mirroring Git Changes From One Server to Another Server

Hello all, nowadays most of the development teams using GIT version control, some of you may have a requirement of mirroring your team's git changes from one server to another Git server. This article will help you to achieve the Git mirroring between one server to another server.