Author: Nicola Pietroluongo
Viewers: 147
Last month viewers: 2
Categories: PHP Tutorials
In the first part of this article we covered the basic benefits of working it explaining some of the most commonly used features, some very well known, others not so much.
Read this part the article to learn how use Git in projects the involve collaboration between multiple developers, how to take advantage of existing Web platforms that support Git, and how to migrate from older version control applications like SubVersion.
Contents
Introduction
Collaboration Between Developers
What is Git Flow?
Who to Blame for bugs?
Web platforms using Git
GitHub
Bitbucket
Migrating from SubVersion to Git
Conclusion
Introduction
This part of the article assumes that you are familiar with the concepts of Git introduced in the article first part.
This time it is covered the application of those concepts to improve the quality of your software development environment.
Collaboration Between Developers
Previously branches were described as a means to work on new experimental features without interfering with the main code of your project.
Lets see how branches and other features of Git can be used in practice to promote better collaboration between developers working on the same project.
What is Git Flow?
Git Flow is a model for creating branches with Git, created by Vincent Driessen. It became popular among the community of developers that work with Git because it is very convenient for collaboration within development teams and works well when the teams grow.
When a developer starts working on a new feature or bug fix, he creates a new branch. When he is done with the new feature or the fix, he merges the new branch back to the main branch.
GitFlow supports feature branches and hot fixes. The feature branch will be merged back to the develop branch (some kind of staging area) ready to be release. The hot fixes are done on tagged release that will only contain emergency fixes, so they are treated in isolation.
For developers, changing between the branches they are working on, or starting new feature branches in the middle of something is fast and easy to do with Git. Git keeps track of the modifications without creating a new repository from scratch.
It is easy to see and follow what each collaborator is doing, inspecting the commits and jumping on branches.
Who to Blame for bugs?
If you have found a bug in your code and you want to know when was introduced and why, you can use git blame command. This is a command that shows when each line of a given file was last edited and by whom.
Web platforms using Git
GitHub
Bitbucket
Bitbucket is sometimes the company choice because of the strong team management tool it provides.
Bitbucket also provides additional features like:
Online tools for comparing branches
Management of pull requests, with comment and easy inspection about changes (useful often in a review process)
It is easy inspection of commits and see the flow of the structure
Allow comments
Create and track issues
Integrations and support for other 3rd party tools like IDE, Web platform, services, and others
Migrating from SubVersion to Git
If you have been using SubVersion version control application and you would like to switch to Git, migrating from a SubVersion repository to Git is quite easy using several tools that are available on the Web like svn2git and subgit.
Every tool mainly follows two steps to perform the conversion:
1. Checkout the svn repository
2. Conversion to Git including the commit history
Some tools provide the possibility to synchronize back to SubVersion after having done modifications to the project using Git.
Conclusion
In this part of the article we learned about important practices using Git that make collaboration between multiple developers work better in your project, important features of the two main project Web hosting platforms that support Git, and how to migrate to Git from SubVersion.
If you liked this article or have a question, post a comment here.
You need to be a registered user or login to post a comment
1,616,107 PHP developers registered to the PHP Classes site.
Be One of Us!
Login Immediately with your account on:
Comments:
1. i following - tinashe zulu (2015-09-02 00:47)
getting better... - 2 replies
Read the whole comment and replies