29. Creating a conflict

Goals

  • Creating a conflicting of changes in the master branch.

01 Return to the master and create conflict

Return to the master branch and make the following changes:

git checkout master

File: lib/hello.html

<!-- Author: Alexander Shvets (alex@githowto.com) -->
<html>
  <head>
    <!-- no style -->
  </head>
  <body>
    <h1>Hello, World! Life is great!</h1>
  </body>
</html>

Run:

git add lib/hello.html
git commit -m 'Life is great!'

(Warning: make sure you've used single-quotes to avoid problems with bash and ! character)

02 View branches

Run:

git hist --all

Result:

$ git hist --all
* 454ec68 2011-03-09 | Life is great! (HEAD, master) [Alexander Shvets]
| * 5813a3f 2011-03-09 | Merge branch 'master' into style (style) [Alexander Shvets]
| |\  
| |/  
|/| 
* | 6c0f848 2011-03-09 | Added README [Alexander Shvets]
| * 07a2a46 2011-03-09 | Updated index.html [Alexander Shvets]
| * 649d26c 2011-03-09 | Hello uses style.css [Alexander Shvets]
| * 1f3cbd2 2011-03-09 | Added css stylesheet [Alexander Shvets]
|/  
* 8029c07 2011-03-09 | Added index.html. [Alexander Shvets]
* 567948a 2011-03-09 | Moved hello.html to lib [Alexander Shvets]
* 6a78635 2011-03-09 | Add an author/email comment [Alexander Shvets]
* fa3c141 2011-03-09 | Added HTML header (v1) [Alexander Shvets]
* 8c32287 2011-03-09 | Added standard HTML page tags (v1-beta) [Alexander Shvets]
* 43628f7 2011-03-09 | Added h1 tag [Alexander Shvets]
* 911e8c9 2011-03-09 | First Commit [Alexander Shvets]

After an Added README commit master branch has been merged with the style branch, but at there is an additional master commit, which was not merged back to the style.

03 Next

The last change in master conflicts with some changes in style. In the next step we will solve this conflict.