Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

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 (?) , you can switch to a simple comment.
Switch to a voting comment New
Blob21
Highly Voted 2 years, 10 months ago
C seems correct. See https://www.arubacloud.com/tutorial/installation-and-first-steps-with-git.aspx
upvoted 7 times
...
jchavarria12
Most Recent 2 years, 8 months 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
3 years, 5 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
3 years, 4 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]
2 years, 1 month ago
git-checkout - Switch branches or restore working tree files
upvoted 2 times
...
...
...
mutan
3 years, 6 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 ...