AZ-400 git push --force Practice Question
Your organization is migrating from Azure Repos to GitHub. You have 200 repositories with complex branching strategies and build policies. You need to preserve the commit history and branch policies. What is the best migration approach?
⚠ Common exam trap
Candidates often assume the GitHub Importer tool can also migrate branch policies, but it only migrates repository code and history. Platform-specific policies like branch protection must be recreated manually or via API.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use git push --force to push all branches to GitHub and recreate policies manually
The GitHub Importer tool does not preserve branch policies; it only migrates repository history and code. To keep commit history and then recreate branch policies, the best approach is to use `git push --force` to push all branches from Azure Repos to GitHub, then recreate branch policies manually or via the GitHub API. This ensures complete history is preserved while policies are re-established separately.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Manually recreate each repository in GitHub and copy the code from Azure Repos
Why it's wrong here
Manually recreating repositories is error-prone and does not preserve commit history or policies efficiently.
- ✗
Use a third-party tool to perform a mirror clone and then push to GitHub
Why it's wrong here
A third-party mirror clone and push can migrate history, but it does not handle branch policies, and the step of recreating policies is not explicitly mentioned, making it less straightforward than option D.
- ✗
Use the GitHub Importer tool with a custom mapping script to migrate repositories and policies
Why it's wrong here
The GitHub Importer tool migrates repository history and code but does NOT preserve branch policies, so it fails to meet the requirement of preserving policies.
- ✓
Use git push --force to push all branches to GitHub and recreate policies manually
Why this is correct
Using `git push --force` migrates all commit history, and then recreating policies manually or via API ensures both history and policies are preserved.
Go deeper
Related to this question
Learn chapter
Introduction to DevOps and Azure DevOps
Key term
GitHub
GitHub is a cloud-based platform for storing, tracking, and collaborating on code using Git version control.
Key term
Git
Git is a version control system that tracks changes to files so multiple people can work on the same project without overwriting each other's work.
About these practice questions
One of 823 original AZ-400 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AZ-400 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-400 exam.