DevOps Tools Engineer (LPIC-OT 701) — Question 47

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?

Answer options

Correct answer: B

Explanation

The correct command to revert a file to its last committed state is 'git checkout' rather than 'git revert'. The 'git revert' command is used to create a new commit that undoes changes, which is not applicable here since the changes haven't been committed yet. Options A, D, and E are not valid commands for reverting changes in a file.