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.
Loading...
Related Quiz
- For database version control, the practice of _______ with Git ensures that database changes are reviewed before being deployed.
- A developer needs to temporarily switch context to another task without committing their current, incomplete work. What Git feature is most appropriate for this scenario?
- An essential lesson from Git failures is the need for robust ________ in enterprise environments.
- Which Git command is used to download a repository from a remote server?
- In what scenario might you use a git filter-branch?