Learning three-way recursive merge

Cleo Buenaventura - Sep 21 - - Dev Community

Three-way recursive merge

A method used in version control systems to automatically combine changes from different branches. It works by comparing three versions of the code, which is the base, head, and the branch to be merged. By analyzing the differences between these versions, the merge tool attempts to integrate changes seamlessly.

How I merge

Ever since I've learned how to use Git and GitHub to work collaboratively with group members, I have always followed a procedure where I resolve any conflicts in my branch first before merging to main or making a PR. This way, I prevent any issues making it to the main branch for failing to resolve the conflict properly.
If someone else merged to main that is working on the same feature/file as me on a different branch, then I would retrieve the latest version of main and merge it into my working branch to resolve any conflicts made.

Working on parallel branches

Now, this method of working on parallel branches and merging changes at the same time is new to me. At first I thought, why? Wouldn't this create conflicts?
This where I learned the term fast-forward, which happens when there's no separate development between the branches. In this case, the three-way recursive merge isn't needed. Instead, Git just moves the pointer of the current branch forward to the latest commit, essentially making it as if both branches were always in sync. No extra merging is necessary because the history is linear.

Issues and Merge commits

I created two separate issues to work on GENEREADME, #14 and #15, with the respective commits that closed the issues 1f7222d and 3d0b9cf.

For the lab, one of the requirements was to close the issues by linking the respective commits in the comments of the issue. So this is where I noticed that after pushing the merge to main, I do not see the merge commit to main for issue #14, instead I only see the merge commit for issue #15.

Image description

And I learned that this is where the fast-forwarding happened.

Conflicts

I ended up having a very small conflict when I made the merge since I was working on the same file for both issues. The issues were caused by the new code I added due to adding the support for a new provider.

. . . . . . . . . . . .
Terabox Video Player