CS FundamentalsHardProduct-company MCQ pattern
A file secrets.env was committed last month. Today you add secrets.env to .gitignore and commit. Why does git status still show changes to it, and what fixes that?
- A. Because .gitignore needs a restart of Git; running git gc fixes it
- B. Because .gitignore must be committed on main first; merging it fixes it
- C. Because the pattern is case-sensitive; writing SECRETS.ENV fixes it
- D. Because .gitignore only affects untracked files; git rm --cached secrets.env stops tracking it while keeping it on disk
Correct answer: D. Because .gitignore only affects untracked files; git rm --cached secrets.env stops tracking it while keeping it on disk
.gitignore never applies to files already in the index. git rm --cached removes the file from tracking (it stays in old history, so a leaked secret must still be rotated).
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- Two developers branch from the same commit. In which of these situations will git merge report a conflict? 1. Both changed different…
- Match each SOLID principle with the violation it forbids. P. Single Responsibility Q. Interface Segregation R. Open/Closed S. Dependency…
- Match each pattern with its intent. P. Builder Q. Facade R. Proxy S. Strategy 1. Give a simple single entry point to a complex subsystem…
- Assertion (A): A lazily initialised Singleton that checks if (instance == null) before creating the object can end up with two instances…
- How many of the following HTTP methods are idempotent by the HTTP specification: GET, PUT, DELETE, POST?
- Assertion (A): In a RESTful API, every request from the client must carry all the information needed to process it, such as an auth token…