A developer discovers that confidential files were accidentally committed to a public Git repository. What steps should be taken to resolve this?

  • Identify and note down the commit hash. Use git reset or git revert to undo the commit.
  • Use git rm to remove the files from the repository, commit the changes, and push.
  • Create a new branch, cherry-pick the desired commits without the confidential files, and push.
  • Use git filter-branch to remove the files from the entire history and force push the updated repository.
Option 2 involves removing the confidential files and making a clean commit, ensuring that sensitive information is not exposed. Other options may have drawbacks or potential risks, such as force-pushing to a shared repository.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *