Repository navigation
2 Branch Versioning
Managing branch versioning is an important practice for team software development, and GitHub is a source code hosting platform that provides tools for managing this process. GitHub allows you to create new branches from the main branch, work on changes, and then merge the changes back into the main branch when they are ready.
Main
The main branch is the primary one of the project and contains the most recent and stable code that has been tested and approved for production. To ensure the integrity of the main branch, it is protected against direct changes, allowing only merge requests from the develop branch. Additionally, code review policy is a recommended practice to ensure the quality and security of code in software projects. Thus, when a pull request is opened to merge into the main branch, the author cannot approve the request. It is necessary for at least two people who are not the author of the pull request to review and approve the changes before merging them with the main branch. This helps to ensure that the added code is of high quality, compatible with the existing code, and free of critical errors.
Develop
The develop branch is used for the ongoing development of the project. It is created from the main branch and is used as an environment for developers to integrate their features. When a feature is completed, it is merged into the main branch. Like the main branch, the develop branch is protected against direct changes. To integrate new features into the develop branch, it is necessary to open a pull request and wait for code review by at least one person who is not the author of the pull request. Additionally, the author of the pull request cannot approve the request to ensure review by other developers. This helps to ensure that the added code is of high quality, compatible with the existing code, and free of critical errors before it is merged into the main branch.
Feature
Feature branches are created from the updated develop branch and are used to develop new features or fix specific project bugs. It is important to note that each feature branch should correspond to only one specific feature. After the feature is completed, the feature branch is merged back into the develop branch through a pull request, and code review is essential to ensure that the changes are of high quality and in line with project guidelines. It is recommended that at least one person reviews and approves the changes before merging them with the develop branch. This practice helps to maintain a clear history of the development of each feature and to avoid conflicts in the code. Additionally, the use of feature branches helps to maintain an organized and efficient development process, enabling greater efficiency and quality in project development. The naming convention for creating feature branches is "feature-". This convention helps to easily identify the origin and purpose of each branch, making communication and collaboration among team members more efficient.