CS FundamentalsHardProduct-company placement · Git
A developer uses git worktree add ../hotfix main while her current directory has feature checked out. Which statement is correct?
- A. It clones the repository again, so the two directories get separate object stores
- B. It switches the current directory to main and moves the feature checkout to ../hotfix
- C. It adds a second working directory on main sharing this repository; one branch can't be checked out twice
- D. It stashes feature's uncommitted changes so that they can be applied inside ../hotfix
Correct answer: C. It adds a second working directory on main sharing this repository; one branch can't be checked out twice
Worktrees share one .git object database and refs, so commits made in either are visible to both, but each has its own HEAD and index. Git blocks checking out one branch in two worktrees to avoid conflicting updates.
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 Scrum team keeps pulling stories into sprints that lack acceptance criteria and depend on undecided UX. Which agreement addresses this…
- In a speech-recognition system, independent knowledge sources (acoustic, lexical, syntactic) each read and update a shared store of…
- IFPUG rates an external input by file types referenced (FTR) and data element types (DET): with 0–1 FTR it is low up to 15 DETs and…
- A static analyser marks request parameters as untrusted, follows them through assignments and calls, and warns when one reaches a SQL…
- Code smells: in system X, adding a new payment type forces small edits in eight classes. In system Y, the class Report is edited for…
- Code reads if account.getBalance() >= amount: account.setBalance(account.getBalance() - amount). Which principle does this break, and what…