In this article, we will talk about feature branching in git and managing projects in source control platforms.
For source control operations as we all know we have a master branch that covers our project as a whole and we want this branch to be as clean as possible. The feature branching model is a way of source control management that aims to keep the master branch bug-free and always ready for development.
The main idea of feature branching is when a developer wants to add a new feature to the project. He or she creates a branch. This branch gets a specific id and a name for the idea that it wants to implement. Having an id is important at this point because it will be useful for us when we are going to merge the feature branch back to master.
After the feature branch is created the developer starts work on the feature. At this point, there can be two scenarios. One of them is a developer can finish the feature and then ask for a pull request. This means that “I’m finished on my feature and this feature is ready to be merged with master branch”. When the pull request is sent, the feature gets into a code review. After the code review, the new feature gets its testing process with the related issue that can be found from its feature id. And if there are no problems with it, the feature merges with the branch and everything is fine.
The other scenario is when the developer is working on the feature branch another developer can already be finished with his branch and made his pull request, pass the testing and already merged the feature to the branch. In this case, the feature branch that cloned from the master and the updated master branch is not the same. But git has a solution for that also, the developer can make a pull from the master branch to get the updated master branch and then continue working on the feature. After the feature has finished it can make it pulls request as usual and after the code review and the tests, again it’s ready to merge with the master and everything is ready to repeat in another new feature.
With this process, we always keep the master branch unaffected from the unsupervised updates so it will be more clean and stable.