Explore the key differences and best practices of GitFlow and Trunk-Based Development workflows in git. This quiz helps you understand branching models, release strategies, and team collaboration techniques fundamental to efficient version control.
Which Git workflow typically uses a 'develop' branch in addition to 'main' or 'master' to handle feature integration?
Explanation: GitFlow utilizes both a 'develop' and a 'main' branch to organize features and releases, making the integration process more structured. Trunk-Based Development discourages long-lived branches like 'develop', focusing mainly on a single shared branch. Feature Branch Workflow and Forking Workflow do not necessarily prescribe a 'develop' branch explicitly. This makes GitFlow unique in its explicit branching model.
In Trunk-Based Development, how are releases usually managed when the team needs to ship production-ready code frequently?
Explanation: Trunk-Based Development minimizes branch complexity by using temporary release branches only when needed for stabilization or deployment. GitFlow, by contrast, maintains permanent release and develop branches. Directly pushing to release or tagging staging branches are not best practices in this context and can introduce integration risks. Keeping minimal branching is core to Trunk-Based Development.
What is a primary advantage of Trunk-Based Development for large teams working on a single product?
Explanation: Trunk-Based Development encourages frequent integration to a common branch, which reduces the duration and risk of merge conflicts. Keeping feature branches short-lived ensures rapid feedback and smoother collaboration. Long-lived feature branches, delayed integration, and avoiding branching entirely can all create bigger issues for large teams. Thus, short development cycles are key in Trunk-Based Development.
Why are feature flags often used alongside Trunk-Based Development in rapid delivery environments?
Explanation: Feature flags enable teams to integrate partially completed features safely by controlling visibility to end users. This compatibility supports continuous delivery in Trunk-Based Development. They do not keep branches synced, serve as a replacement for code reviews, or resolve merge conflicts. Feature flags offer flexibility for shipping code safely and incrementally.
In which scenario would GitFlow be more appropriate than Trunk-Based Development?
Explanation: GitFlow is designed for projects that require maintaining and supporting several release versions simultaneously, which is useful for teams dealing with different customer requirements. Trunk-Based Development is suited for frequent, rapid deployments and is not ideal for parallel release management. Applying hotfixes directly to trunk or experimental solo workflows would not benefit from GitFlow's structure. Therefore, GitFlow stands out when parallel version support is required.