Courseiva
Design and implement a source control strategyeasyMultiple ChoiceObjective-mapped

AZ-400 Practice Question: Design and implement a source control strategy

Your team is using Git with Azure Repos. A developer accidentally committed a large binary file to the main branch. What is the recommended way to permanently remove it from the repository history?

⚠ Common exam trap

Watch out — candidates often confuse `git revert` (which creates a new commit that undoes changes but preserves history) with `git filter-branch` (which rewrites history to permanently remove content), leading them to choose option C despite it leaving the large file accessible in the commit log.

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 filter-branch' to remove the file from history

`git filter-branch` (or its modern replacement `git filter-repo`) rewrites the entire repository history to permanently remove a file from all commits. This is the recommended approach when a large binary file has been committed to the main branch and must be expunged from history to reduce repository size and prevent it from being cloned by others.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Delete the file and commit the deletion

    Why it's wrong here

    Deleting the file and committing the deletion only removes it from the latest commit; the file remains in every prior commit in the history, so the repository still contains the sensitive or large data and the overall size is not reduced. This approach fails to scrub the file from the repository, which is typically required for leaked credentials or oversized artifacts.

  • Ignore the file using .gitignore

    Why it's wrong here

    Adding the file to .gitignore only prevents it from being tracked in future commits; it has no effect on commits that already exist. Because Git stores blobs by content, any historical commit that includes the file will keep it reachable, so the file remains in the repository and in history.

  • Revert the commit using 'git revert'

    Why it's wrong here

    git revert creates a new commit that undoes the changes introduced by the target commit, but the original commit and the file's blob remain in the repository's history. This is safe for shared branches but does not remove the file from history, so it does not address the need to eliminate the file entirely.

  • Use 'git filter-branch' to remove the file from history

    Why this is correct

    git filter-branch rewrites the commit history by applying a filter (e.g., --index-filter or --tree-filter) to remove the file from every commit, making it as if the file never existed. This permanently removes the file from history, but it rewrites commit SHAs and requires force-pushing and coordination with all collaborators to avoid reintroducing the file.

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 →

How Courseiva writes practice questions · Editorial policy

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.