Practical Git


Posted by
Sébastien Delcoigne

January 2, 2014

Atlassian has made the jump to Git around the en of 2012. After months of experience they came up with a list of good practices that have helped them be successful and that will help you too.

Git at Atlassian

Being in an open company, Atlassian teams are happy to share knowledge about their products. Recently they started sharing about the technical side of things. After a series of blog posts detailing their switch to Git this past summer, they started a series of webinars presenting this technology in details. Sarah Goff Dupont, Product Marketing Manager for Bamboo at Atlassian, recently gave a webinar calledGit Ready. Here is what to remember.

Centralized repository

Even though Git enables to get out of the centralized repository paradigm, it is still the best option for the vast majority of software companies. Free/Libre software projects have good reasons to go with the Integrator or Dictator models because the list of contributors on those projects is not easily controllable. For software companies though, the list of collaborators is well known and the risk of congestion at the integration level becomes to big. Plus the need for decentralization is rarely important.

Feature branching

Git branchingThis is one of the major benefits of Git over SVN. We have all felt the dread of the incoming merge. Our beloved features facing the unavoidable conflicts management session. With Git, this management is immensely reduced. Git does most of the merging for you, and if you manage to keep your user stories size small, there’s a good chance Git will be able to do it all without your help.

Another big advantage of these feature branches : they allow developers to backup their work regurlarly without having to worry about disrupting other people’s work. This considerably limit the risk of loosing precious work.

Pull Requests

Pull requestsA good way to key a good level of code quality on your repositories is to make use of pull requests accompagnied by code reviews. Stash, also developed by Atlassian, helps you automate these code reviews in order to smooth the whole process. It also gives you a simple way to finely set access control on your repositories, which can be a little tricky with the Git tool.

What about CI?

CI with BambooWith an explosion of feature branches, the CI server can quickly be overloaded. Even if automation is important and should always be attempted; with the example of Bamboo which can automatically clone plans for cloned branches; it is not an absolute obligation. You might keep your feature branches plans manual for example. The size of your teams and that of your CI server will lead you to the appropriate decision.

More with Git Hooks

git hooksHooks are scripts triggered on particular events of the Git cycle. They add interesting actions either on the server or locally on the developer’s machine. With hooks, you can add code formatting or code validation. You can check commit messages and force a specific format, even trigger cascading merges, etc. Hooks are powerful tools that enable to automate event more your development processes.

Dream or Reality ?

Is what Atlassian managed applicable to every company ? At Valiantys, we have made the move towards Git 2 weeks ago. Far from having the necessary experience to analyse all the benefits of this technology, we can still already measure some real and meaningful benefits compared to SVN.

Speed

Speed This is not a myth. Git is way faster. Cloning a repository takes mere seconds when it used to take several minutes for the initial checkout of a SVN repository. And what about analysing log history ! The local Git repository already contains all the necessary information and this operation is almost immediate. Whatever the size of the repository.

Feature Branches

They are talked about a lot, but they deserve it. Feature branches revolutionize a developer’s life.

Integration with the Software Factory

Software factoryWe were already using Jira, Confluence and Bamboo. The move to Git enabled us to add Stash (accompagnied by SourceTree) to the stack. Moving towards an always better integration of the entire chain of development.

Conclusion

Judging the evolution of its user base only these last years, Atlassian is a successful company. One of the reasons of this success resides in their management of the life cycles of their many products. When many companies have trouble delivering more than one release per year, at Atlassian, new releases are available several times per trimester, sometimes every 3 weeks for some products. And Git is a key tool in the process.