One of the most important reasons for using git is its ability to merge files - it's the number one collaboration tool in our industry.
I makes sense to study and understand exactly what a git merge is.
Three-way-merge
Git uses (default) a standard three-way-merge when it merges files.
It's a simple algorithm.
- Two (2) files must be merged
- They have a (1) common ancestor - 2+1=3 - hence the name - three-way--merge
- Each contributing file is line-by-line compared against the common ancestor
- Change rules if one of the contributors has either deleted, added or altered a line in the file, then that change also goes into the result.
- If both contributors have different opinions about the same line - then it's a conflict
Let's stir the pot and potentially create a conflict - which we can then solve.
After you have seen it on GitHub go back to the file and make a change to the file.
.gitconfigthat makescurrentthe default push strategyOne of the most important reasons for using git is its ability to merge files - it's the number one collaboration tool in our industry.
I makes sense to study and understand exactly what a git merge is.
Three-way-merge
Git uses (default) a standard three-way-merge when it merges files.
It's a simple algorithm.
Let's stir the pot and potentially create a conflict - which we can then solve.
merge-labpoem.txtwith the following poem:gitCLI toaddandcommitthe poem to git.git tagto create a tag namedancestorgit pushto push it to GitHub - make sure that the also the tag is pushed!After you have seen it on GitHub go back to the file and make a change to the file.
!to a puntuation.gitCLI toadd,commit,push.