Question #968
A development team is preparing to deploy version 2.0 of their application. They need to stabilize the release candidate while continuing development on the main branch for version 2.1. All bug fixes for version 2.0 must be isolated from the main branch. After deployment, the fixes must be integrated into the main branch.
Which solution meets these requirements?
Create a release branch from the commit intended for version 2.0. Apply fixes to the release branch. Continue developing new features on the main branch, merging them into main. After deployment, merge the release branch into main.
Create a Git tag on the commit for version 2.0. Continue developing new features on main, merging into main. Apply fixes to the main branch. Update the Git tag to the latest main commit.
Create a release branch from the version 2.0 commit. Apply fixes to the release branch. Continue developing on main, merge features into main. Rebase main onto the release branch after deployment.
Create a Git tag on the version 2.0 commit. Continue developing on main, merge features into main. Apply fixes directly to the Git tag.
Explanation
Answer A is correct because:
1. Release Branch Isolation: Creating a release branch from the version 2.0 commit ensures bug fixes are isolated from the main branch (version 2.1 development).
2. Parallel Development: New features can continue on the main branch without interference from 2.0 fixes.
3. Post-Deployment Integration: Merging the release branch into main after deployment ensures fixes are incorporated into future development.
Why other options are incorrect:
- B: Git tags are immutable markers; applying fixes to the main branch violates isolation requirements.
- C: Rebasing main onto the release branch rewrites history, risking conflicts and losing context.
- D: Git tags cannot be updated with new commits; fixes cannot be applied directly to a tag.
Key Takeaway: Use release branches to isolate stabilization efforts and merge them back post-deployment to maintain code integrity.
Answer
The correct answer is: A