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: Marina Pushkova (marina@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) [Marina Pushkova]
| * 5813a3f 2011-03-09 | Merge branch 'master' into style (style) [Marina Pushkova]
| |\  
| |/  
|/| 
* | 6c0f848 2011-03-09 | Added README [Marina Pushkova]
| * 07a2a46 2011-03-09 | Updated index.html [Marina Pushkova]
| * 649d26c 2011-03-09 | Hello uses style.css [Marina Pushkova]
| * 1f3cbd2 2011-03-09 | Added css stylesheet [Marina Pushkova]
|/  
* 8029c07 2011-03-09 | Added index.html. [Marina Pushkova]
* 567948a 2011-03-09 | Moved hello.html to lib [Marina Pushkova]
* 6a78635 2011-03-09 | Add an author/email comment [Marina Pushkova]
* fa3c141 2011-03-09 | Added HTML header (v1) [Marina Pushkova]
* 8c32287 2011-03-09 | Added standard HTML page tags (v1-beta) [Marina Pushkova]
* 43628f7 2011-03-09 | Added h1 tag [Marina Pushkova]
* 911e8c9 2011-03-09 | First Commit [Marina Pushkova]

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.

SVN?
© 2011-2014 Git How To. All rights reserved / Contact us