Courseiva
hardMultiple Choice

200-901 Practice Question: A developer is using Git for version control of a…

A developer is using Git for version control of a Python library. A colleague accidentally committed a large sensitive file. Which Git command sequence should be used to remove the file from history without losing subsequent changes?

⚠ Common exam trap

Cisco often tests the distinction between removing a file from the working tree versus removing it from the entire commit history, leading candidates to mistakenly choose `git rm` or `git revert` which only affect the latest state, not the historical record.

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

✓

git filter-branch or git filter-repo

`git filter-branch` and `git filter-repo` are designed to rewrite Git history, allowing you to permanently remove a large sensitive file from all commits. This is necessary when a file has been committed and pushed, as simple removal with `git rm` only affects the latest commit and leaves the file accessible in prior history. Using these commands ensures the file is purged from the entire repository history without losing subsequent changes, as they replay the commit graph while filtering out the specified file.

Answer analysis

Option-by-option breakdown

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

  • ✓

    git filter-branch or git filter-repo

    Why this is correct

    git filter-branch and git filter-repo rewrite the entire commit history, purging the sensitive blob from every commit while preserving later commits and their changes. This satisfies the stem's constraint of removing the file from history without losing subsequent work.

  • ✗

    git rm --cached && git commit

    Why it's wrong here

    git rm --cached only untracks the file in the next commit, leaving the blob in prior history, so the sensitive data remains recoverable. It is tempting because it removes the file from the working tree, and would be correct where the requirement is stopping future tracking rather than purging history.

  • ✗

    git rebase -i && git commit --amend

    Why it's wrong here

    Interactive rebase with amend rewrites only the most recent commit, so an earlier sensitive file remains in history; it cannot excise a blob from older commits. It is tempting because rebase -i edits commit messages and squashes recent work, which suits tidying a short unpublished branch, not purging a file across all history.

  • ✗

    git revert HEAD

    Why it's wrong here

    git revert HEAD creates a new commit undoing the last change, leaving the sensitive file intact in earlier history and still cloneable. It is tempting because revert safely reverses a pushed commit without rewriting history, which is right when undoing a normal bad change on a shared branch, not erasing a file.

About these practice questions

Courseiva writes every 200-901 question from scratch — 975 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. 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 200-901 practice question is part of Courseiva's free Cisco 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 200-901 exam.