nerdexam
Cisco

200-901 · Question #630

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…

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…

Software Development and Design

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?

Exhibit

200-901 question #630 exhibit

Options

  • Agit reset --hard
  • Bgit stash
  • Cgit checkout origin/master -f
  • Dgit fetch origin

How the community answered

(29 responses)
  • A
    83% (24)
  • B
    3% (1)
  • C
    10% (3)
  • D
    3% (1)

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

#Git#Version Control#Discarding Changes#Developer Workflow

Community Discussion

No community discussion yet for this question.

Full 200-901 Practice