CS FundamentalsVery hardProduct-company placement · Git interview
A faulty merge M of feature into main was undone with git revert -m 1 M. The feature team later fixes the bug with a new commit on feature and merges feature into main again. What goes wrong, and what is the fix?
- A. Only the new fix commit comes in, because Git considers the feature's earlier commits already merged; revert the revert first, then merge
- B. Nothing goes wrong; the whole feature returns automatically
- C. Git refuses the second merge
- D. The second merge duplicates every feature commit
Correct answer: A. Only the new fix commit comes in, because Git considers the feature's earlier commits already merged; revert the revert first, then merge
Reverting a merge undoes its changes but not its history: the feature's commits remain ancestors of main. Re-merging brings only newer commits, so the original feature code stays reverted until the revert itself is reverted.
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
- You run git stash pop and it reports a merge conflict in f.txt. What happens to the stash entry?
- During git rebase -i, what is the difference between marking a commit 'squash' and marking it 'fixup'?
- On main you need the version of config.yml that exists on branch release, without merging anything else. Which command does this, and what…
- A file was renamed from util.js to helpers.js three months ago. git log helpers.js shows only the commits since the rename. Which command…
- Branches deleted on the remote still appear in git branch -r on a developer's machine. Which command removes these stale remote-tracking…
- On a cumulative flow diagram for a Kanban board, the band for 'In Review' keeps getting wider over several weeks while the 'Done' line…