Software Development and Project Management

In Git, two developers changed the same line of the same file on different branches, and one branch was then merged into the other. Which describes what happens?

  1. AThe change with the newer commit time is adopted automatically, and the older change is discarded
  2. BThe changes on the receiving branch always take priority, and the other branch's changes are discarded automatically
  3. CThe merge stops with a conflict, and a developer examines the content and resolves it by deciding which change to keep (or how to combine both)
Show answer and explanation

Answer: C. The merge stops with a conflict, and a developer examines the content and resolves it by deciding which change to keep (or how to combine both)

A Git merge compares the changes on both branches since their common ancestor and combines changes in different places automatically. If the same place was changed on both sides, it cannot be decided mechanically which is correct, so the merge stops with a conflict and both versions are marked in the file. The developer edits the file to resolve it, tests, and then commits. Merging often rather than keeping branches apart for a long time is an effective way to reduce conflicts.

  • A. Git does not choose changes by time. Changes to the same place are resolved by a person.
  • B. A standard merge does not automatically discard either side's changes; it stops with a conflict.
  • C. Correct. Changes to the same place become a conflict, which a person resolves.
Practice this topic Back to topic

Related calculators

Books on Software Development and Project Management Ad

As an Amazon Associate I earn from qualifying purchases.

More Software Development and Project Management questions

  1. Which method of reviewing design documents or source code is led by a moderator, assigns roles to the participants, is carried out formally using checklists and the like, and records the defects found and confirms their correction?
  2. After a firmware version known to work correctly there are 1,000 commits, and the latest commit has a bug. The bug was introduced by one commit and occurs in every commit after it. When the culprit commit is identified by binary search, as with git bisect, what is the maximum number of times the firmware must be built and tested?
  3. In a WBS, which breaks down a project's deliverables and work hierarchically, what is the element at the lowest level, used as the unit for estimating duration and cost and assigning people?
  4. In an arrow diagram with nodes ① to ⑥, the activities, written as 'name: start node → end node, duration', are A: ① → ②, 6 days; B: ① → ③, 4 days; C: ② → ④, 4 days; D: ③ → ⑤, 4 days; E: ④ → ⑥, 2 days; F: ⑤ → ⑥, 3 days; and a dummy activity: ② → ③ (duration 0). What is the shortest duration of the whole project?
  5. A project has the following activities, durations and predecessors: A: 4 days (no predecessor); B: 2 days (none); C: 3 days (A); D: 2 days (B); E: 5 days (C); F: 4 days (C and D); G: 2 days (F). If all other activities start as early as possible, what is the maximum number of days by which the start of activity B can be delayed without extending the total project duration?