Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Cisco 200-901 Exam - Topic 4 Question 105 Discussion

Which command reverses the last commit without changing the index file or the working tree position?
C) git reset --soft HEAD^
A) git revert HEAD
B) git reset --hard HEAD~3
D) git revert

Cisco 200-901 Exam - Topic 4 Question 105 Discussion

Actual exam question for Cisco's 200-901 exam
Question #: 105
Topic #: 4
[All 200-901 Questions]

Which command reverses the last commit without changing the index file or the working tree position?

Show Suggested Answer Hide Answer
Suggested Answer: C

The command git reset --soft HEAD^ reverses the last commit but keeps the changes staged in the index file (staging area) and working directory. Here's what the command does:

git reset --soft: Moves the HEAD pointer to the specified commit (in this case, the parent of the current commit, denoted by HEAD^) but leaves the changes from the reset commit in the staging area.

HEAD^: Refers to the parent commit of the current HEAD.

This command is useful when you want to uncommit the last commit but keep the changes for further modification or recommit them.


Git Documentation - git reset

Cisco DevNet Associate Certification Guide

Contribute your Thoughts:

0/2000 characters
Gail
5 months ago
C) is nice for keeping changes, but A) is safer for just reverting.
upvoted 0 times
...
Christa
5 months ago
I prefer A) too. It’s clear and straightforward.
upvoted 0 times
...
Celestina
5 months ago
But what about D)? It just says git revert. Is it specific enough?
upvoted 0 times
...
Wava
5 months ago
A) seems right. It doesn't mess with the index.
upvoted 0 times
...
Vilma
6 months ago
I feel like C) git reset --soft HEAD^ is also a good option. It keeps changes.
upvoted 0 times
...
Isreal
6 months ago
No way, it's not D. That's just a general revert command!
upvoted 0 times
...
Steffanie
6 months ago
Wait, does that really not change the working tree?
upvoted 0 times
...
Tracey
7 months ago
A makes the most sense to me!
upvoted 0 times
...
Keena
7 months ago
I thought it was C) git reset --soft HEAD^?
upvoted 0 times
...
Jerry
7 months ago
I prefer to just use a time machine to undo my commits.
upvoted 0 times
...
Florinda
7 months ago
B) git reset --hard HEAD~3 is a bit overkill.
upvoted 0 times
...
Cathrine
7 months ago
D) git revert is the easiest option.
upvoted 0 times
...
Sheridan
7 months ago
C) git reset --soft HEAD^ is the way to go.
upvoted 0 times
...
Latosha
8 months ago
I feel like "git reset --soft HEAD^" might be the right answer, but I can't recall if it affects the working tree.
upvoted 0 times
...
Therese
8 months ago
I remember practicing a question like this, and I think "git revert HEAD" is the one that just creates a new commit.
upvoted 0 times
...
Sherill
8 months ago
Ah, I got it! The question is asking for a command that reverses the last commit without changing the index or working tree. That means it has to be git revert HEAD. Option A is the answer.
upvoted 0 times
...
Nikita
8 months ago
I've seen this type of question before. I think the key is to understand that we want to reverse the last commit without affecting the index or working tree. That points me towards option C - git reset --soft HEAD^.
upvoted 0 times
...
Lon
8 months ago
Wait, I'm a bit confused. Isn't reset used to undo commits? I'm not sure which one is the right choice here.
upvoted 0 times
...
Arlene
8 months ago
I think it's either A or C, but I'm not entirely sure which one specifically doesn't change the index.
upvoted 0 times
...
Murray
9 months ago
A) git revert HEAD is the correct answer.
upvoted 0 times
...
Linn
9 months ago
I think it's A) git revert HEAD. It just undoes the commit.
upvoted 0 times
...
Brynn
9 months ago
I thought "git revert" was the command that undoes changes without affecting the index, but I'm confused about the options.
upvoted 0 times
...
Omer
9 months ago
It's definitely A) git revert HEAD.
upvoted 0 times
...
Florencia
9 months ago
Okay, I think I know this one. I'm pretty sure it's option A - git revert HEAD.
upvoted 0 times
...
Stevie
10 months ago
Hmm, this one seems tricky. I'll need to think carefully about the differences between reset and revert.
upvoted 0 times
Leandro
4 months ago
I’d go with git revert HEAD for this one.
upvoted 0 times
...
Annmarie
4 months ago
Yeah, reset changes the history.
upvoted 0 times
...
Alfred
4 months ago
I think revert is safer for commits.
upvoted 0 times
...
Cruz
5 months ago
Same here! It’s confusing.
upvoted 0 times
...
Luis
5 months ago
I always mix up reset and revert.
upvoted 0 times
...
...

Save Cancel