CS FundamentalsVery hardProduct-company placement · Git interview
main has A-B-C. feature1 branched from C with commits D-E, and feature2 branched from E with commits F-G. feature1 is abandoned, but feature2 must go onto main without D and E. What does git rebase --onto main feature1 feature2 produce?
- A. C-D'-E'-F'-G' on feature2
- B. C-F'-G' on feature2: only the commits in feature2 but not in feature1 are replayed onto main
- C. feature1 is moved onto main
- D. A merge commit joining feature1 and feature2
Correct answer: B. C-F'-G' on feature2: only the commits in feature2 but not in feature1 are replayed onto main
rebase --onto <newbase> <upstream> <branch> replays the commits reachable from branch but not from upstream (F, G) onto newbase. A plain git rebase main on feature2 would also carry D and E.
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 edits a tracked file app.py, creates a new file util.py, and runs git commit -a -m "update". What is committed?
- A CI job runs git clone --depth 1 on a large repository. Which statement is correct?
- Assertion (A): Raising average server CPU utilisation from 50% to 95% to save cost usually makes response times much worse. Reason (R): In…
- In 30 days a service had 4 incidents with total downtime of 6 hours. What are its mean time between failures (uptime-based) and its…
- A team distinguishes elasticity from scalability. Which statement is correct?
- A team considers splitting its monolith into microservices. Which of these is the strongest reason to do it?