CS FundamentalsVery hardGATE CS · TCS NQT Prime · Product Company SDE
A developer checks out a specific commit directly by its hash (not a branch name), ending up in 'detached HEAD' state, and then makes two new commits there. What is the risk if they later switch to a branch without creating a new branch at the detached commit first?
- A. Those two commits become unreachable from any branch and are at risk of eventual garbage collection, though reflog can usually still recover them for a while
- B. The commits are immediately and permanently deleted with no recovery possible
- C. The commits are automatically merged into the branch being switched to
- D. Git refuses to let you switch branches in this situation
Correct answer: A. Those two commits become unreachable from any branch and are at risk of eventual garbage collection, though reflog can usually still recover them for a while
Commits made in detached HEAD belong to no branch; once HEAD moves elsewhere, they have no ref keeping them reachable and risk being garbage collected, though reflog offers a recovery window.
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 graphics application needs to create a new shape by copying an existing, fully-configured one (rather than re-specifying every property…
- A rolling deployment updates instances of a service:
- A long-lived feature branch has fallen far behind main, and its author wants a clean, linear history without the clutter of many…
- Two components with availability 99.0% and 98.0% are connected in series (the system works only if both are up). What is the system's…
- A control-flow graph has 14 edges, 8 nodes and 1 connected component. Using V(G) = E − N + 2P, what is its cyclomatic complexity?
- A PERT activity has optimistic time 2 days, most likely time 6 days and pessimistic time 9 days. What is its expected duration, Te = (O +…