nerdexam
MicrosoftMicrosoft

AZ-400 · Question #428

AZ-400 Question #428: Real Exam Question with Answer & Explanation

This question tests knowledge of Git commands to restore a specific historical revision of a file. The goal is to retrieve the third most recent version of App.exe.config in the main branch.

Submitted by mateo_ar· Mar 6, 2026Design and implement source control

Question

Hotspot Question You use Git for source control. You have an app named App1. In the main branch, you need to restore the third most recent revision of a file named App.exe.config. How should you complete the command? To answer, select the appropriate options in the answer area. NOTE: Each correct selection is worth one point. Answer:

Options

  • __typehotspot
  • variantdropdown

Explanation

This question tests knowledge of Git commands to restore a specific historical revision of a file. The goal is to retrieve the third most recent version of App.exe.config in the main branch.

Approach. The correct command is: 'git checkout main3 -- App.exe.config'. The 'git checkout' command is used to restore files from a specific commit. 'main3' is the relative ref syntax meaning '3 commits before the tip of the main branch' (i.e., the third most recent revision). The '--' separator tells Git that what follows is a file path, not a branch name, and 'App.exe.config' specifies the exact file to restore. This stages the restored version of the file in the working directory and index, ready to be committed.

Concept tested. Git relative commit references and file restoration using 'git checkout <ref> -- <file>'. Key concepts include: (1) tilde notation (HEADn or branchn) to reference ancestor commits - ~1 is parent, ~2 is grandparent, ~3 is great-grandparent (third most recent); (2) the '--' separator to distinguish file paths from branch/commit names; (3) using 'git checkout' (or 'git restore' in newer Git versions) to restore a specific file from a historical commit without switching branches.

Reference. https://git-scm.com/docs/git-checkout - Git documentation on checkout with tree-ish and pathspec

Topics

#Git commands#version control#file restore#Git checkout

Community Discussion

No community discussion yet for this question.

Full AZ-400 PracticeBrowse All AZ-400 Questions