Creating a Conflict

Goals

  • Create a conflicting change in the master branch.

Switch back to master and create a conflict

Switch back to the master branch and make this change:

Execute:

  1. git checkout master

lib/hello.rb

  1. puts "What's your name"
  2. my_name = gets.strip
  3. puts "Hello, #{my_name}!"

Execute:

  1. git add lib/hello.rb
  2. git commit -m "Made interactive"

View the Branches

Execute:

  1. git hist --all

Output:

  1. $ git hist --all
  2. * a87176d 2020-06-20 | Merge branch 'master' into greet (greet) [Jim Weirich]
  3. |\
  4. * | 228a31e 2020-06-20 | Updated Rakefile [Jim Weirich]
  5. * | 98cfd8a 2020-06-20 | Hello uses Greeter [Jim Weirich]
  6. * | cf0438b 2020-06-20 | Added greeter class [Jim Weirich]
  7. | | * ee97f8e 2020-06-20 | Made interactive (HEAD -> master) [Jim Weirich]
  8. | |/
  9. | * 8d90176 2020-06-20 | Added README [Jim Weirich]
  10. |/
  11. * 5aec14d 2020-06-20 | Added a Rakefile. [Jim Weirich]
  12. * 721b979 2020-06-20 | Moved hello.rb to lib [Jim Weirich]
  13. * 907a445 2020-06-20 | Add an author/email comment [Jim Weirich]
  14. * 4254c94 2020-06-20 | Added a comment (tag: v1) [Jim Weirich]
  15. * c8b3af1 2020-06-20 | Added a default value (tag: v1-beta) [Jim Weirich]
  16. * 30c2cd4 2020-06-20 | Using ARGV [Jim Weirich]
  17. * 4445720 2020-06-20 | First Commit [Jim Weirich]

Master at commit “Added README” has been merged to the greet branch, but there is now an additional commit on master that has not been merged back to greet.

Up Next

The latest change in master conflicts with some existing changes in greet. Next we will resolve those changes.