CS FundamentalsModerateTCS · Infosys · Git interview
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. Git fast-forwards anyway because no merge is needed
- B. A merge commit is created, preserving the feature's commits as a visible side branch in history
- C. The feature's commits are squashed into one
- D. Git refuses because --no-ff needs diverged branches
Correct answer: B. A merge commit is created, preserving the feature's commits as a visible side branch in history
--no-ff forces a merge commit even when a fast-forward is possible, recording that a group of commits belonged to one feature. Teams use it so the feature can be reverted as one unit.
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 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…
- What does this Singleton implemented with a metaclass print? python class Meta(type): inst = {} def call(cls, a, k): if cls not in…
- This Observer code registers three listeners. What does it print? python class Subject: def init(self): self.obs = [] def attach(self, f)…