Microsoft DevOps Engineer Expert AZ-400 Practice Question
Your Azure Repos Git repository contains an accidentally-committed JSON file that includes production credentials. The file was committed eight months ago, has been modified several times since, and now exists in dozens of historical commits on every developer clone and in the remote origin. You must permanently eradicate all versions of the file from the entire repository history while keeping the rest of the commit data intact and minimizing execution time on a repository of several thousand commits. After the history is rewritten you will force-push the cleaned branch and instruct other developers to reclone.
Which approach meets these requirements with the least effort?
Add the file name to .gitignore, commit, and push to ensure the file is no longer tracked.
Run the BFG Repo-Cleaner to delete the file from the entire history, then force-push the rewritten branch.
Use git filter-branch with an index-filter to remove the file and then force-push the rewritten branch.
Delete the file in the current branch tip and push; enable an Azure DevOps branch policy that rejects commits referencing the file.
git filter-repo and the BFG Repo-Cleaner are both recommended tools for deleting every instance of a file from an entire Git history. BFG is designed specifically for speed on large repositories and uses a simplified syntax (for example, bfg --delete-files secrets.json) that completes the task significantly faster than git filter-branch, which is now deprecated for this scenario. Removing the file only in the latest commit leaves the credentials in earlier commits, and an Azure DevOps branch policy cannot rewrite history at all. Therefore, using the BFG Repo-Cleaner followed by a forced push best satisfies the requirement to eradicate the secret across all commits with minimal effort and execution time.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the BFG Repo-Cleaner and how does it work?
Open an interactive chat with Bash
Why is git filter-branch deprecated for this scenario?
Open an interactive chat with Bash
What steps should developers take after using BFG Repo-Cleaner to clean the repository?
Open an interactive chat with Bash
Microsoft DevOps Engineer Expert AZ-400
Design and implement a source control strategy
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .