AZ-400 · Question #457
Drag and Drop Question You have an Azure Repos repository named repo1. You delete a branch named features/feature11. You need to recover the deleted branch. Which three commands should you run in sequ
The correct answer is git checkout <COMMIT>; git branch features/feature11; git restore <COMMIT>. To recover a deleted branch in Git, you first use 'git checkout <COMMIT>' to navigate to the last commit that the deleted branch pointed to (found via git reflog or similar), then 'git branch features/feature11' to recreate the branch at that commit point, and finally 'git restor
Question
Exhibit
Answer Area
Drag items
Correct arrangement
- git checkout <COMMIT>
- git branch features/feature11
- git restore <COMMIT>
Explanation
To recover a deleted branch in Git, you first use 'git checkout <COMMIT>' to navigate to the last commit that the deleted branch pointed to (found via git reflog or similar), then 'git branch features/feature11' to recreate the branch at that commit point, and finally 'git restore <COMMIT>' to restore the working tree files to that state. This sequence effectively recreates the deleted branch by identifying its last known commit and re-establishing the branch reference pointing to it.
Topics
Community Discussion
No community discussion yet for this question.
