SagarBharate / merge-conflict

https://lab.github.com/githubtraining/managing-merge-conflicts
MIT License
0 stars 0 forks source link

Create your own Conflict #4

Closed github-learning-lab[bot] closed 5 years ago

github-learning-lab[bot] commented 5 years ago

Step 5a: Create your own conflict

So far, this pull request doesn't have any conflicts, but I have added some new branch protections to prevent you from merging before you're ready.

In the last activity, you solved a merge conflict that someone else created. This time, you'll create the merge conflict yourself.

:keyboard: Activity: Make changes on this branch

  1. Click on the Files changed tab in this pull request
  2. Click the :pencil2: found in the top right-hand corner of the _data/education.yml file that had been previously modified
  3. Modify the content in the degree:, uni:, year:, and summary: lines
  4. Scroll to the bottom of the page and enter a commit message for your change
  5. Click the Commit changes button, making sure the "Commit directly to the add-education branch" option is selected

Watch below for my response

github-learning-lab[bot] commented 5 years ago

Step 5b: Merging similar changes

Good job! Remember from the last issue that your history now looks something like this, without conflicts:

branch commits

However, in a real world scenario, it's possible that a peer or colleague will have edited the same file in the same place as your pull request.

To demonstrate, I'll stand in as your colleague :wave:. In Pull Request https://github.com/SagarBharate/merge-conflict/pull/3, you'll see that the education file has been changed. If the other pull request is merged to master first, you will see a conflict in your pull request. Let's try it now.

:keyboard: Activity: Merge "Another User's Change"

  1. Click on https://github.com/SagarBharate/merge-conflict/pull/3
  2. Follow the instructions in that pull request to approve it

Return to this pull request for next steps

github-learning-lab[bot] commented 5 years ago

Step 7: Resolve conflicts you created

Good job! By making commits on two branches, you've created a history just like you saw in your previous conflict.

deviated branches

Typically, this happens when someone else merges a branch into master that has commits in the same files you've been working on.

:keyboard: Activity: Resolve the conflict

  1. In the "This branch has conflicts that must be resolved" section of the pull request, click Resolve conflicts.

Because you created both conflicts, feel free to resolve these conflicts as you wish.

Try and test your memory without a step-by-step breakdown! If you can't remember the exact steps, [here's a link]() to your previous PR with the more detailed instructions for conflict resolution.


Watch below for my response

github-learning-lab[bot] commented 5 years ago

Step 8: Merge the third pull request

Great job, @SagarBharate, your pull request is free of conflicts. :tada:

:keyboard: Activity: Merge this pull request

Go ahead and merge this pull request now.

  1. Click Merge pull request below
  2. Click Confirm Merge
  3. Click Delete branch

Watch below for my response

github-learning-lab[bot] commented 5 years ago

Great work

You created your first merge conflict!

Are you ready to try a more complicated conflict?


Find the next conflict here!