When making a deployment to production, should I mark my code with a label or create a branch for the code that's in production?
In TFS, I would have a Release branch with a label identifying the specific version being released to production.
Which would imply you have other branches may I suggest the following
- Three major branches: Main, Develop, & Release.
- One Hotfix branch for your current fire.
- 0 to N Major-Feature branches to contain the disruption of development.
Details
- Main Branch
- Contains the latest stable builds
-
Tag/Label each release
- Develop Branch
- Branched from the Main
- Where most of the work is done
- Merge back to Main before release
- Release Branch
- Branched from one of the following:
- The Develop branch
- OR the Main branch (this may be better since it is "stable")
- Bug fixes are done here
- After fixes are tested and released,
- merge to Develop branch
- OR merge to Main branch and then forward integrate (FI - which is a merge from parent to child) to Develop
-
Tag/Label each release or bug fix
- Hotfix Branch
- Branched from Main
- Merged back into Main
- Forward integrate merge to Develop
- Used to allow Main to remain "stable"
- Major Feature Branches
- Branched from Develop
- Merged back into Develop
- Used for major features that would possibly disrupt the regular development path
References:
- another stack overflow question: when-to-use-a-tag-label-and-when-to-branch especially Martin Woodward's answer
-
Source Control How To by Eric Sink
-
A successful Git branching model by Vincent Driessen
- This contains a very good graphic of a branching model
Ideally, both.
You probably want to have a label so that you know exactly what you delivered for a specific release. However, you probably also want to create a branch so that you can perform minor bug fixing to what was released and create a new release.