A user pushed a sensitive file Data.txt to a GitHub repository. You must purge the file from the repository history. Which command (or command sequence) can you use to accomplish this?
Choose an answer
Tap an option to check your answer.
Correct answer: bfg --delete-files data.txt git push --force.
Why this is the answer
The BFG Repo-Cleaner (bfg) is a powerful tool specifically designed for removing large or sensitive data from Git repository history. The command bfg --delete-files data.txt will rewrite the repository history to remove all traces of data.txt. Following this with git push --force updates the remote repository with the rewritten history. git rm data.txt git push --force only removes the file from the current commit, not from previous history. git filter-repo --invert-paths --path data.txt git push origin --force --all is a valid alternative for purging files, but bfg is often simpler for this specific task and is widely recognized for it. The provided git filter-repo command would keep data.txt and remove everything else due to --invert-paths. git checkout git reset --hard -pathspec data.txt and git checkout git clean -d data.txt --force are for managing the working directory or staging area, not for rewriting history. git revert -edit data.txt git push -force creates a new commit that undoes changes, but the sensitive file still exists in previous history.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed