200-901 · Question #630
200-901 Question #630: Real Exam Question with Answer & Explanation
The correct answer is A: git reset --hard. The git reset --hard command discards all local changes and resets the working directory to the state of the last commit in the current branch. In this case, it would resolve the issue by reverting the local changes to match the state of the repository, enabling the developer to
Question
Refer to the exhibit. A developer is working on a project and makes a few changes to test the code. After testing, the developer wants to revert to last commit but fails. Which command discards local changes?
Options
- Agit reset --hard
- Bgit stash
- Cgit checkout origin/master -f
- Dgit fetch origin
Explanation
The git reset --hard command discards all local changes and resets the working directory to the state of the last commit in the current branch. In this case, it would resolve the issue by reverting the local changes to match the state of the repository, enabling the developer to pull updates or merge without conflicts.
Topics
Community Discussion
No community discussion yet for this question.