DevOps Engineer interview question · Most asked
Trunk-based development or GitFlow: which do you prefer, and why?
Summary
Trunk-based development (short-lived branches merged to main at least daily, kept releasable, with unfinished work behind feature flags) supports continuous delivery and is associated with higher delivery performance in DORA's research. GitFlow (long-lived develop and release branches) suits scheduled releases of versioned software but creates merge pain and slows feedback.
Longer Answer
Trunk-based development requires strong automated testing, fast CI, feature flags or branch-by-abstraction for incomplete work, and code review that keeps up (small pull requests). GitFlow can still fit products that ship versioned releases to customers who upgrade on their own schedule (mobile apps, on-premise software), though even there many teams use trunk-based development with release branches cut from main.
Key Points
- Trunk-based: small, frequent merges to main.
- Associated with higher delivery performance.
- Needs fast CI and feature flags.
- GitFlow for versioned, scheduled releases.
More most-asked DevOps Engineer questions
- How do you handle secrets in CI/CD pipelines securely?
- What are DORA metrics, and how would you use them without gaming them?
- What happens when you type a URL into a browser and press Enter?
- Design a CI/CD pipeline for a containerised microservice from commit to production.
- How do you handle database schema migrations in an automated deployment pipeline?
- Your CI pipeline takes 45 minutes. How would you speed it up?
- What is platform engineering, and how does it relate to DevOps?
- How do you secure the CI/CD pipeline itself against supply-chain attacks?