Courseiva
Process — Managing Technical AspectsmediumMultiple ChoiceObjective-mapped

PMP Process — Managing Technical Aspects Practice Question

Network Topology
$ git logonelinegraphRefer to the exhibit.```|/* 789abc0 Initial commit

Refer to the exhibit. The project team uses Git for version control. The lead developer accidentally committed a bug fix directly to the main branch instead of the feature branch. What is the best course of action to maintain a clean history?

⚠ Common exam trap

It's easy for candidates to confuse 'revert' with 'reset' or assume merging is always safe, overlooking that cherry-picking is the precise tool to move a single commit to another branch without altering the source branch's history.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Cherry-pick the bug fix commit to the feature branch, then revert the commit on main.

It preserves a clean Git history by first cherry-picking the bug fix commit from main to the feature branch (ensuring the fix is applied where intended), then reverting the commit on main to remove the accidental change without rewriting history. This avoids merge commits or destructive operations, maintaining a linear and traceable project history.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Revert the commit on main and do nothing else.

    Why it's wrong here

    Reverting the commit on main alone would create a new commit that undoes the bug fix. However, this action does not transfer the fix to the feature branch. If the feature branch were later merged into main or rebased on it, the revert commit would be included, effectively removing the bug fix from the feature branch's history as well, or at least making it unavailable there. The fix would be lost from the feature branch's lineage.

  • Cherry-pick the bug fix commit to the feature branch, then revert the commit on main.

    Why this is correct

    Cherry-picking the bug fix commit to the feature branch first applies the specific changes from that commit as a new commit on the feature branch, ensuring the fix is present where it's needed. Subsequently, reverting the original commit on main creates a new commit that cleanly undoes the bug fix on main without rewriting history. This two-step process safely isolates the fix to the feature branch while removing it from main in a non-destructive manner.

  • Merge main into feature to include the bug fix.

    Why it's wrong here

    Merging main into feature would indeed bring the bug fix commit into the feature branch. However, this operation would also pull in all other commits that exist on main since the feature branch diverged or last synchronized. This introduces potentially unrelated or incomplete work into the feature branch, complicating its development, increasing the risk of conflicts, and creating an unnecessary merge commit, which is not the targeted, surgical approach required.

  • Reset main to the commit before the bug fix, then force push.

    Why it's wrong here

    Resetting main to the commit before the bug fix, followed by a force push, rewrites the history of the main branch. While this would remove the bug fix from main, force pushing a rewritten history to a shared remote branch is highly destructive and dangerous. It can cause significant disruption for other collaborators who have already pulled the original main branch, potentially leading to lost work, complex rebase scenarios, or divergent histories, making it an unacceptable practice for shared branches.

About these practice questions

This PMP question is part of Courseiva's 800-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This PMP practice question is part of Courseiva's free PMI certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PMP exam.