Eliminate Merge Nightmares with Git Essentials: Part One

 

It’s late in the workday and I’ve just checked in the last chunk of code that brings together all of the individual pieces of functionality for a new feature that my team and I have been working on for the last couple of weeks. As the team lead, this is the point in the project where I normally would have to prepare myself for potential merge hell. When starting a new piece of functionality, I create a new branch off of the mainline (master) branch to isolate our team’s changes from other unrelated development work, with the intention of keeping our isolated branch up to date with the changes going on in the mainline but because this is a manual process it often gets forgotten. Now I am back at the helm of a branch that has diverged from the mainline for a number of weeks, crossing my fingers that the merge goes through without a hitch. As anyone who has worked on a code base that multiple teams are actively developing against at the same time knows, rarely will this merge succeed without numerous conflicts. Unless you are exceptionally lucky! (in which case you should also buy a lottery ticket).

So… with my fingers crossed I issue the pull request from our isolated feature branch into the mainline branch where we will be releasing the product increment from in a few days time. Now, imagine the scenario where your team has been heavily refactoring an area of complex code for the last couple of weeks, in order to fit in a new piece of functionality and during the merge process you discover that another team has been doing similar work in the exact same area of code. Slowly, I uncross my fingers as the realization sinks in that I have encountered just that scenario and I’ll be unable to merge my team’s changes into the mainline branch without significant code changes and/or breakage analysis. In my mind, the planned delivery date is now in jeopardy…

With Atlassian Git Essentials, this scenario is a thing of the past…

I Need a New Branch Quick!

The concept of a daily code check-in has been around for a while and is a widely used development technique to keep all team members up to date with each other’s code changes to allow for better collaboration in highly dependent areas of functionality. The goal is to avoid having working code isolated locally on a developer’s workstation for any longer than a work day. Now, think about isolated branches and how they continually diverge from their mainline branches right from the point of creation.  Why do we not employ this same concept for our branches? The most often heard criticism of such a strategy is that creating branches is time consuming and there is too much overhead associated with them. Here is where the integration within the Git Essentials product line really shines!

With JIRA Agile, new Stash branches can be created easily and on the fly with a single click of the “Create Branch” link from within every single JIRA issue. This provides the development team with the flexibility to create branches whenever necessary without ever having to leave JIRA. Creating these lightweight branches in this manner automatically links the new branch to the JIRA issue. The JIRA Development Panel (See Fig. 1) within the issue allows for exceptional transparency of all activity within the new branch from a code perspective as well as any build/deployment activity occurring from within Bamboo.

Branch creation doesn’t get any better than that!

Fig. 1

Fig. 1

Do I Have to Setup the CI Server Now?

In the past creating and maintaining new branches was often thought of as a time consuming process with a lot of associated overhead. In order to reap all of the benefits of long lived branches you would often need to get in touch with an administrator user who had the ability to add new branches to the automated build process. Even the act of creating and destroying a branch often involved getting users with a certain level of permissions involved every time.

With Git Essentials, you no longer have to bother your administrator colleagues to get going with lightweight branching strategies. As soon as a new branch is created in Stash or directly from within JIRA agile, Bamboo has the ability to automatically recognize the new branch and start the continuous integration process when any new code changes are added to the branch using the parent branches settings by default. Your new branches will be running all of the build and test scenarios that you would expect effortlessly!

While Stash offers the ability to automatically clean up and remove branches after successful merges, Bamboo has the ability to ensure that these lightweight branches never start to pile up and clutter up the code repository.

Developers are not usually very good at cleaning up after themselves after all!

Fig. 2

Fig. 2

How Do I Get Started With Git Essentials?

With all of these key features built into the Atlassian Git Essentials product it’s a no brainer to get started now to immediately start improving your development team’s daily operational efficiency. Contact the Atlassian Experts at Avant today to get set up with these industry leading tools or for a more in depth demonstration on how these tools can be leveraged within your company to increase confidence in timelines and overall throughput for all of your software projects.

 

Keep an eye out for our second installment in the series, Eliminate Merge Nightmares with Git Essentials: Part Two which will provide some insight into how automated merge schemes built-in to Git Essentials will further reduce the chances of you and your team encountering the merge hell scenario!

logoGitEssentials

Browse the case_studies archive. Bookmark the permalink.