Microsoft DevOps Engineer Expert (AZ-400) · Section 2 · 13% of the exam
Configure tags to organize the source control repository
One of the objectives of the Exam AZ-400: Designing and Implementing Microsoft DevOps Solutions exam, in the section “Design and implement a source control strategy”. Here is what it covers, the points to remember and a question to try.
What it covers
Tags mark releases, reflog and revert get work back, and history-rewriting tools remove secrets and huge files for good. This lesson shows when to use each Git command, how Azure Repos and GitHub support tagging and restoring branches and repositories, and why removing data from a shared repository takes more than a delete commit.
Points to remember
- Annotated tags store tagger, date and message (can be signed); lightweight tags are just names. The Azure DevOps portal creates annotated tags only.
- Tags are not pushed by default: git push origin <tag> or --tags; delete remotely with git push origin --delete <tag>.
- Azure Repos: Create tag permission for Contributors; Force push at repository or All tags level to delete a tag.
- Use revert on shared branches (adds history) and reset locally (rewrites); revert a merge with -m 1.
- git reflog and git branch rescue <sha> recover work after reset, rebase or branch deletion in your own clone.
Try a question
A developer ran git reset --hard HEAD~3 by mistake and lost three local commits that were never pushed. Which approach recovers them?
- ARun git fetch to download them from the origin server and update your local branch with the lost commits
- BRun git gc --prune=now to rebuild the commits
- CRun git reflog to find the previous HEAD, then git reset --hard or git branch rescue to that entry
- DRun git revert HEAD to cancel the reset
Show the answer
C. The reflog records where HEAD and branches pointed in the local clone. The lost commits are still in the object database and reachable from the reflog entry, so you can reset to it or create a branch there.
Written for practice in the style of the exam: never a question from the real exam.
In the course
The lesson Tags, recovering data and removing data from Git teaches this objective (about 45 minutes), and 16 practice questions test it. The course has lessons, exam-style questions, timed practice exams and an AI tutor for every objective, and a pass prediction that tells you when you're ready to book.
More in this section
- Design a branch strategy, including trunk-based, feature branch, and release branch
- Design and implement a pull request workflow by using branch policies and branch protection rules
- Implement branch merging restrictions by using branch policies and branch protection rules
- Design and implement a strategy for managing large files, including Git Large File Storage (LFS) and git-fat
- Design a strategy for scaling and optimizing a Git repository, including Scalar and cross-repository sharing
- Configure permissions in the source control repository
- Recover specific data by using Git commands
- Remove specific data from source control