Flags separate deployment from activation but add configuration states and cleanup obligations. Every flag needs an owner and retirement plan.
Before you start
You should understand commits, branches, the working tree and the staging area. Draw the commit graph before changing history. Try commands in a disposable repository with a clean working tree so you can observe exactly which references and files each operation changes.
The practical goal is to reason through this situation: Enable a new search path for a small cohort after the code is deployed. Read the walkthrough first, then try the interview exercise before opening its answer. The important part is explaining the decision and its consequences, rather than remembering a definition alone.
Step-by-step walkthrough
Step 1: Assign lifecycle ownership
Each flag needs a purpose, owner and retirement condition.
Step 2: Test supported combinations
Deployment and activation create additional configuration states.
Step 3: Remove obsolete branches
After recovery needs end, delete unused code and settings deliberately.
Worked scenario
Enable a new search path for a small cohort after the code is deployed.
A new search implementation is enabled for a small cohort after deployment. The fallback must remain compatible while rollback is needed. Once the old path is retired, leaving the flag indefinitely adds states reviewers and tests must still consider, increasing complexity without a continuing requirement.
Common mistake
Permanent unmanaged flags create combinations that are difficult to test.
Verify the behavior
Test both active paths and the flag-removal migration.
Interview exercise
Remove a completed flag safely.
Answer and reasoning
Confirm activation and rollback needs, delete obsolete branches and configuration, then validate the remaining behavior.
Continue learning
Compare the scenario with the Git and CI/CD interview questions and test your understanding with the Git and CI/CD MCQs. For terminology and implementation details, consult the reference material.