Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Bring together two branches (who shared a parent once) into a single branch with all their histories

Mohit Sahay
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 9, 2020

Unique scenario: Say a branch A existed once. B was branched off from A and after some time C was branched off from B. Both B and C have diverged and have different feature sets. Now, we want to bring the two feature sets together into a single branch without losing all the commit histories that went into both B & C after C branched-off from B. The catch? We really do not want to do traditional merge. What we want is to have both these exist side-by-side. Example: 

Say a folder "hereWeGo" existed in B with 5 files. After C was created, in C "hereWeGo" was modified and it added 3 more files and changed a couple of original files. What we want to do is create a branch (which ever way) in which we can bring together files and folders from both the branches and have them live together. Sounds crazy. So, in the new branch "hereWeGo" from B would exist and "hereWeGo" from C could be renamed to "hereWeGo_X" and coexist with "hereWeGo". 

We do not really want to overwrite any changes done since the original branch-off. We want to consolidate the code into a single branch but keep all their histories intact. 

Why all this? Code is too huge to resolve merge in a short time and has diverged a lot. So, we want to make piecemeal attempt in resolving and ultimately merge the files (5 and 8 respectively) in "hereWeGo" and "hereWeGo_X" into a single "hereWeGo" with 8 files. But that's future.

I understand this sounds crazy but given the awesome tool git is I believe there would be some way to handle this scenario. Any help would be appreciated. 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events