Courseiva
Junos Automation Stack And DevOps ConceptshardMultiple ChoiceObjective-mapped

JNCIA-DevOps Junos Automation Stack And DevOps Concepts Practice Question

An automation engineer is using Git and needs to undo the last local commit while keeping the modified changes in their working directory as unstaged changes. Which command should they execute?

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 HEAD~1 (or git reset --mixed HEAD~1)

'git reset --soft HEAD~1' or 'git reset HEAD~1' resets the commit while keeping working tree files modified/staged depending on flags. 'git reset HEAD~1' defaults to mixed (keeps changes unstaged).

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 reset --hard HEAD~1

    Why it's wrong here

    --hard destroys all working directory changes.

  • git checkout -f master

    Why it's wrong here

    This discards local work and switches to master.

  • git reset HEAD~1 (or git reset --mixed HEAD~1)

    Why this is correct

    Correct. git reset HEAD~1 keeps the working tree changes intact while undoing the commit.

  • git revert --purge

    Why it's wrong here

    No such command as git revert --purge exists.

About these practice questions

This JNCIA-DevOps question is part of Courseiva's 307-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 and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed August 2026 · checked against the official Juniper Networks exam blueprint

This JNCIA-DevOps practice question is part of Courseiva's free Juniper Networks 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 JNCIA-DevOps exam.