CS FundamentalsHardWipro · Accenture pattern
You checked out an old commit by its hash, made two commits, then ran git checkout main. What happened to those two commits?
- A. They were deleted immediately and cannot be recovered
- B. They were automatically added to main
- C. They still exist but are not on any branch; they can be recovered with git reflog and a new branch, until garbage collection removes them
- D. They were moved to a branch called HEAD
Correct answer: C. They still exist but are not on any branch; they can be recovered with git reflog and a new branch, until garbage collection removes them
In detached-HEAD state new commits belong to no branch. After switching away they become unreachable but remain in the object store and reflog (by default for weeks); git branch rescue <hash> saves them.
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
- 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…
- 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?