CS FundamentalsHardProduct-company placement · Git interview
You run git branch -d experiment and Git refuses: 'the branch is not fully merged'. You force it with git branch -D. Which statement is correct?
- A. The branch's commits are deleted from disk immediately
- B. The commits disappear from the remote too
- C. The branch label is removed; its commits become unreachable but can still be recovered via the reflog until garbage collection prunes them
- D. -D merges the branch into main before deleting it
Correct answer: C. The branch label is removed; its commits become unreachable but can still be recovered via the reflog until garbage collection prunes them
A branch is just a pointer. Deleting it leaves the commits in the object store; the reflog (or git fsck) can find their hash for a new branch until they expire and are garbage-collected.
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
- While running git rebase main on your feature branch, a conflict appears. In this situation, what do git checkout --ours and --theirs…
- A feature branch is merged into main with git merge --no-ff feature, although main had not moved since feature branched. What is the result?
- A developer wants to find out which commit introduced the string 'legacyPay(' anywhere in the code base, even though the commit messages…
- What does this Prototype-style code print? python import copy class Doc: def init(self, title, tags): self.title = title self.tags = tags…
- What does this Decorator-pattern code print? python class Coffee: def cost(self): return 50 def desc(self): return "coffee" class AddOn…
- What does this Chain of Responsibility code print? python class Handler: def init(self, limit, name, nxt=None): self.limit, self.name…