exam questions

Exam 701-100 All Questions

View all questions & answers for the 701-100 exam

Exam 701-100 topic 1 question 9 discussion

Actual exam question from LPI's 701-100
Question #: 9
Topic #: 1
[All 701-100 Questions]

The file index.php, which is being maintained in a git repository, was changed locally and contains an error. If the error has not been committed to the repository yet, which of the following git commands reverts the local copy of index.php to the latest committed version in the current branch?

  • A. git lastver "" index.php
  • B. git revert "" index.php
  • C. git checkout "" index.php
  • D. git clean "" index.php
  • E. git repair "" index.php
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️
Reference https://git-scm.com/docs/git-revert

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Blob21
Highly Voted 1 year ago
C seems correct. See https://www.arubacloud.com/tutorial/installation-and-first-steps-with-git.aspx
upvoted 7 times
...
jchavarria12
Most Recent 11 months, 2 weeks ago
git reset is for undoing uncommitted changes, but it isn't an option, next option will be git clean: https://www.atlassian.com/git/tutorials/undoing-changes https://www.atlassian.com/git/tutorials/resetting-checking-out-and-reverting
upvoted 1 times
...
hythalo
1 year, 8 months ago
I agree with mutan. Correct answer is C. git revert only reverts already existing commits. https://git-scm.com/docs/git-revert/2.22.0#_description
upvoted 3 times
Asong01
1 year, 7 months ago
I disagree with mutan and hythalo. Git checkout is used when you want to create a new branch or switch to another branch. By checking out will not affect any changes made in the file. git reset would have been the right answer, but it's not on the list. The closest answer to git reset is git revert. So option B is the CORRECT ANSWER.
upvoted 1 times
[Removed]
4 months, 2 weeks ago
git-checkout - Switch branches or restore working tree files
upvoted 2 times
...
...
...
mutan
1 year, 9 months ago
Isn't the correct answer C? git revert only undos already commited changes.
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago