QuestionQ15

Verified

Examine the model stg_customers_sales in the main branch:

select id as customer_id, name as customer_name from \{\{ source('my_data','my_source') \}\}  

A developer creates a branch, feature_a, from main and modifies the model to:

select id as customer_id, name as customer_name, country as customer_country from \{\{ source('my_data','my_source') \}\}  

A second developer also creates a branch, feature_b, from main and modifies the model to:

select id as customer_id, name as customer_name, address as customer_address from \{\{ source('my_data','my_source') \}\}  

The first developer creates a PR and merges feature_a into main. The second developer then creates a PR and attempts to merge feature_b into main.

How will Git combine the code from feature_b with the code in main, which now also contains the changes from feature_a?

Statement:

“Because feature_a has already been approved and merged into main, the code for the model stg_customers_sales will remain as-is, and the changes from feature_b will not be added.”

Explanation

Both branches make different changes to the same line of the model, so a default Git merge produces a conflict that must be resolved. The earlier merge does not automatically cause Git to discard the later branch’s changes; the resolution can include both columns. (git-scm.com)

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!