Skip to content

Latest commit

 

History

History
114 lines (67 loc) · 2.04 KB

11-Practice-Test-Merge-Conflicts.md

File metadata and controls

114 lines (67 loc) · 2.04 KB

Practice Test - Merge Conflicts

Solutions to practice test - merge conflicts

  • Run git add story-index.txt; git commit -am 'Add index of stories'

    $ git add story-index.txt
    $ git commit -am 'Add index of stories'
    
  • Run the command git push origin master. It should fail with the rejected message

    $ git push origin master
    
  • Read the error message and identify the cause of the failure.

    The remote contains the work you do not have locally
    
  • Run git pull origin master

    $ git pull origin master
    
  • What was the result of the Pull operation?

    Merge Conflict
    
  • Run git log origin/master

    $ git log origin/master
    
  • Inspect the file (use vi editor or just cat story-index.txt) and select the most appropriate statement below. The first section shows Max's data and the second section shows Sarah's data.

    sarah missed the Donkey and Dog story, Max mis-spelt the lion and mouse story
    
  • Update the contents of the file (use vi editor) to keep the correct version of the Lion and Mouse story and keep the Donkey and Dog story as well. Remove all the extra lines added by GIT

    $ cat story-index.txt
    1. The Lion and the Mouse
    2. The Frogs and the Ox
    3. The Fox and the Grapes
    4. The Donkey and the Dog
    
  • Run the command git commit -am 'Resolved merge conflicts and merged story index'

    $ git commit -am 'Resolved merge conflicts and merged story index'
    
  • Run the command git push origin master. It should now go through without an issue.

    $ git push origin master