Quidest?

Git merging

· Lorenzo Drumond

Once you’re happy with your changes, you’ll want to merge them back into the main branch so that they make their way into the final product.

A - B - C main
D - E other_branch

If you merge other_branch into main, Git combines both branches by creating a new commit that has both histories as parents. In the diagram below, F is a merge commit that has C and E as parents. F brings all the changes from D and E back into the main branch.

A - B - C - F main \ / D - E other_branch

1git log --oneline --graph --all

How does merging happen?

Let’s say we start with this:

A - B - C main
D - E vimchadsonly

And we merge vimchadsonly into main by running this while on main:

1git merge vimchadsonly

The merge will:

After:

A - B - C - F main \ / D - E vimchadsonly

References

Next -> git-fast-forward-merge

#boot_dev #history #commit #github #git_directory #primeagen #packed #programming #plumbing #states #optimal #git #configuration #compressed #repos #merging #index #snapshot #working_tree #computer_science #repository #workflow #stage #logs