Courseiva
mediumMultiple ChoiceObjective-mapped

200-901 A team is using Git for version control Practice Question

A team is using Git for version control. A developer accidentally committed a sensitive file. Which Git command should be used to remove the file from the repository history while keeping it locally?

⚠ Common exam trap

Cisco often tests the distinction between removing a file from future commits (git rm --cached) versus purging it from all history (git filter-branch), trapping candidates who confuse 'keeping locally' with 'removing from history'.

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

Git filter-branch, because it rewrites the entire repository history to remove a file from all commits, effectively purging it from the version history while leaving the local working copy untouched. This is the standard Git approach for permanently deleting sensitive data (e.g., passwords, API keys) from the repository's history.

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 rebase -i

    Why it's wrong here

    Interactive rebase can edit commits but does not directly remove files; additional steps like 'git rm' in each commit are needed.

  • git reset --soft

    Why it's wrong here

    This moves the HEAD pointer but does not remove the file from history; it only resets the index.

  • git rm --cached

    Why it's wrong here

    This removes the file from the staging area but does not affect past commits; the file remains in history.

  • git filter-branch

    Why this is correct

    This rewrites history to remove the file from all commits, effectively erasing it from the repository.

About these practice questions

This 200-901 question is part of Courseiva's 989-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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.