AZ-400 Question 66
Select 3Your DevOps team is building a new e-commerce application and wants to adopt a trunk-based development approach. They need to ensure that features are merged frequently, code is kept stable, and production fixes are integrated back into the main branch quickly. Which THREE of the following recommendations should the team follow to effectively implement trunk-based development?
- A
Keep feature branches short-lived, merging changes into the main branch frequently.
- B
Create separate long-lived branches for each major feature and merge them only at the end of the development cycle.
- C
Use release branches primarily for minor bug fixes or patches after a production release, merging those fixes back into the main branch.
- D
Prevent developers from committing to the main branch until all features for the next release are completed.
- E
Instruct each developer to integrate changes at least once a day to the main branch and run automated tests continuously.
Show answer and explanation
Correct answers: A, C, E
Explanation
In trunk-based development, developers work with the main branch as the primary integration point, keeping feature branches short-lived and merging back frequently to avoid large, complex merges. Release branches are typically used only for minor patches that emerge after production deployment, ensuring bug fixes flow back into main. Frequent integrations and automated testing maintain overall code stability. For more information, see Microsoft� guidance on Git branching strategies at https://docs.microsoft.com/azure/devops/repos/git/git-branching-guidance.
- A. Correct.
Option 1: CORRECT. Trunk-based development encourages short-lived feature branches that merge back to the main branch as soon as possible to minimize merge conflicts and keep the code current.
- B. Incorrect.
Option 2: INCORRECT. Using long-lived branches that only merge at the end of a development cycle goes against trunk-based principles. It increases merge complexity and delays integration.
- C. Correct.
Option 3: CORRECT. Trunk-based development typically uses release branches for patching critical issues in production. These fixes then merge back into the main branch to maintain a single source of truth.
- D. Incorrect.
Option 4: INCORRECT. Preventing any commits until an entire feature set is completed delays integration and can lead to large, risky merges, which contradicts trunk-based best practices.
- E. Correct.
Option 5: CORRECT. Frequent integration (at least daily) with a continuous integration pipeline is a core principle of trunk-based development. It helps detect issues early and maintain a stable codebase.