0
0
Gitdevops~20 mins

Trunk-based development in Git - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Trunk-based Development Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What is the main goal of trunk-based development?

Choose the best description of the main goal of trunk-based development in Git workflows.

ATo keep all developers working on a single shared branch to avoid long-lived feature branches.
BTo create multiple long-lived branches for each feature to isolate development.
CTo merge code only once a month to reduce integration conflicts.
DTo use forks instead of branches for all development work.
Attempts:
2 left
💡 Hint

Think about how trunk-based development helps reduce integration problems.

💻 Command Output
intermediate
2:00remaining
What is the output of this Git command sequence?

Given the following commands executed in order, what will be the output of the final git log --oneline?

Git
git checkout -b feature
# make some commits
# commit A
# commit B
git checkout main
git merge feature --no-ff
git log --oneline --first-parent -3
AShows an error because the feature branch was not pushed.
BShows only the commits from the feature branch before merging.
CShows the last 3 commits on main including the merge commit.
DShows the last 3 commits from the feature branch only.
Attempts:
2 left
💡 Hint

Consider what --first-parent does in git log.

🔀 Workflow
advanced
2:00remaining
Identify the correct sequence for a trunk-based development workflow

Which option shows the correct sequence of steps for a developer using trunk-based development?

ACommit directly to trunk without any branching or review.
BCreate a short-lived branch, commit changes, merge back to trunk quickly, delete branch.
CCreate a long-lived feature branch, commit changes over weeks, merge to trunk after completion.
DFork the repository, commit changes, and never merge back to trunk.
Attempts:
2 left
💡 Hint

Think about how trunk-based development handles branches and integration speed.

Troubleshoot
advanced
1:30remaining
Why might frequent merges in trunk-based development cause conflicts?

In trunk-based development, developers merge frequently to the trunk. What is a common cause of merge conflicts in this workflow?

AUsing long-lived branches that never merge back.
BMerging only after all features are complete.
CNot committing any changes before merging.
DMultiple developers editing the same lines of code simultaneously.
Attempts:
2 left
💡 Hint

Think about what happens when two people change the same part of a file.

Best Practice
expert
2:00remaining
Which practice best supports trunk-based development in a CI/CD pipeline?

Choose the best practice that supports trunk-based development to keep the main branch stable and deployable.

ARun automated tests and code quality checks on every commit to trunk before merging.
BOnly run tests once a week on the main branch to save resources.
CAllow developers to merge to trunk without any testing to speed up delivery.
DUse manual testing only after deployment to production.
Attempts:
2 left
💡 Hint

Think about how automation helps maintain code quality in fast workflows.