GitFlow Repository
GitFlow is a branching model for Git that makes it easier for teams to collaborate on projects using the Git version control system. This guide explains how to implement GitFlow for an open source project.
Steps
- Create a new branch called
feature/<feature-name>from thedevelopbranch for each new feature that you want to add to the project. This is where you will do your work on the feature.
git checkout -b feature/<feature-name> develop
-
When you are ready to merge your feature into the
developbranch, create a pull request and have it reviewed by other members of the team. Once the pull request has been reviewed and approved, you can merge it into thedevelopbranch. -
Repeat this process for each new feature that you want to add to the project.
-
When you are ready to create a new release, create a new branch called
release/<version-number>from thedevelopbranch. This is where the final testing and preparations for the release with be done.
git checkout -b release/<version-number> develop
-
When the release is ready, merge it into the
mainbranch and create a new tag with the version number. This will be your new release. -
Finally, merge the
releasebranch back into thedevelopbranch and delete thereleasebranch. This ensures that thedevelopbranch always contains the latest code for the next release. -
When you are ready to create a new hotfix, create a new branch called
hotfix/<issue-fixed>from themainbranch. This is where the hotfix will be developed.
git checkout -b hotfix/<issue-fixed> main
-
When the hotfix is ready, create a PR to merge it into the
mainbranch and create a new tag with the version number. This will be the new release. -
Finally, merge the
hotfixbranch back into thedevelopbranch and delete thehotfixbranch. This ensures that thedevelopbranch always contains the latest code for the next release.