CS FundamentalsHardGATE CS · TCS NQT Prime · Product Company SDE
A developer runs `git reset --hard HEAD~3` on a local branch, discarding the last 3 commits and their changes from the working directory. Are those commits permanently lost?
- A. They are only lost if the repository has no remote configured
- B. Not immediately; they usually remain recoverable via git reflog until Git's garbage collector eventually prunes unreachable objects
- C. Yes, they are deleted from disk the instant the command runs
- D. No, they automatically reappear the next time you commit
Correct answer: B. Not immediately; they usually remain recoverable via git reflog until Git's garbage collector eventually prunes unreachable objects
A hard reset only moves the branch pointer and updates the working tree; the old commits still exist as unreachable objects and can usually be found via reflog until garbage collection eventually removes 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
- For a embedded mode project with Basic COCOMO effort E = 92.8 person-months, the development time formula is D = 2.5 × E^0.32 months. What…
- A single 'Worker' interface forces every implementing class to provide both work() and eat() methods, even though a RobotWorker class has…
- A team wants to run two full versions of a service simultaneously in production, routing a fixed percentage of traffic to each to directly…
- A subsystem has many complex interacting classes (video codecs, audio mixers, subtitle renderers). Client code just wants a single, simple…
- Using Basic COCOMO for a embedded mode project (Effort = 3.6 × (KLOC)^1.2 person-months), what is the estimated effort for a 50 KLOC…
- A tester designs test cases specifically to exercise every branch of an if-else statement in the source code. This is an example of: