CS FundamentalsHardProduct-company MCQ pattern
On main you run git merge --squash feature and then git commit. Afterwards you try git branch -d feature. What happens?
- A. main gets a merge commit with two parents, and the branch is deleted
- B. main gets one ordinary (single-parent) commit, and git branch -d refuses because feature is not recorded as merged
- C. main gets all of feature's commits individually, and the branch is deleted
- D. main gets one ordinary commit, and git branch -d deletes the branch silently
Correct answer: B. main gets one ordinary (single-parent) commit, and git branch -d refuses because feature is not recorded as merged
--squash stages the combined changes but records no merge, so the new commit has one parent and feature's commits are not ancestors of main. git branch -d therefore says 'not fully merged'; git branch -D would force it.
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 checked out an old commit by its hash, made two commits, then ran git checkout main. What happened to those two commits?
- A file secrets.env was committed last month. Today you add secrets.env to .gitignore and commit. Why does git status still show changes to…
- Two developers branch from the same commit. In which of these situations will git merge report a conflict? 1. Both changed different…
- Match each SOLID principle with the violation it forbids. P. Single Responsibility Q. Interface Segregation R. Open/Closed S. Dependency…
- Match each pattern with its intent. P. Builder Q. Facade R. Proxy S. Strategy 1. Give a simple single entry point to a complex subsystem…
- Assertion (A): A lazily initialised Singleton that checks if (instance == null) before creating the object can end up with two instances…