Courseiva
Software Development and DesignhardMultiple SelectObjective-mapped

200-901 Software Development and Design Practice Question

A network automation script uses Git for version control. The developer wants to revert the last two commits on the current branch but keep the changes in the working directory for further modification. Which TWO Git commands can achieve this? (Choose two.)

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

git reset --soft HEAD~2

git reset --soft and git revert can be used; soft reset moves HEAD back but keeps changes staged; revert creates new commits undoing changes.

Answer analysis

Option-by-option breakdown

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

  • git checkout HEAD~2

    Why it's wrong here

    Detaches HEAD, does not revert.

  • git reset --hard HEAD~2

    Why it's wrong here

    Discards changes entirely.

  • git reset --soft HEAD~2

    Why this is correct

    Moves HEAD back two commits, keeps changes staged.

  • git remove HEAD~2

    Why it's wrong here

    Invalid Git command.

  • git revert HEAD~2..HEAD

    Why this is correct

    Reverts the last two commits with new commits, keeping changes in working directory.

About these practice questions

One of 989 original 200-901 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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 200-901 practice question is part of Courseiva's free Cisco 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 200-901 exam.