

Ok, let's combine the conflicts like this: We're lucky because our sample is simple enough to fix manually, however, in real cases, it could become really messy, and that's the reason why we should minimize the conflicts by commit as often as possible. It shows the difference in the two versions of 'Book1'. Note that at this merging phase, we're not on any specific branch but we're somewhere "floating land" which is not 'master' nor 'car'.īut when we open the 'Book1' in our working directory, it shows something like git merge carĪutomatic merge failed fix conflicts and then commit the it's not the one from 'master' nor from 'car'. Now we have two different versions of 'Book1' that were committed to each branch, 'master' and 'car'.ĬONFLICT (content): Merge conflict in Book1Īutomatic merge failed fix conflicts and then commit the git is saying, "I don't know which one is the most up-to-date version. updated 1st line 2015 on car branchĪ428001 updated 1st line 2015 on car branch Year 2014 - updated car git add git commit -m "updated 1st line 2015 on car branch" Then, add the similar line as we've done on the 'master' as its first line: Then, we switch to the 'car' git checkout car Nothing to commit, working directory git branch updated 1st line 2014 on master branchħ9b0888 updated 1st line 2014 on master branch Of course, we need to commit git add git commit -m "updated 1st line 2014 on master branch" Let's modify 'Book1' on the 'master' by adding the following as its first line: Nothing to commit, working directory clean

We are currently on the 'master' branch and we have another branch called lsĤ552553 Added 2nd commit to the car branch So, when we try to merge the 'car' branch, we'll have two different versions of 'Book1', and git has no way to figure out which one to take in.
#Git create branch conflicts update
In this chapter, we'll create conflicts by updating our 'master' branch at the same time we update the 'car' branch. All we had to do was simply appending our new updates to the master trunk.

In other words, in that case, the master branch (trunk) has no updates since we branched 'car' off the 'master'. In the previous chapter ( Fast-forward merge), the merge was very easy because we did not have any conflicts.
