Skip to content

Commit

Permalink
Merge pull request github#603 from github/conflict-harder
Browse files Browse the repository at this point in the history
Merge Conflict Course - Octocat edition
  • Loading branch information
beardofedu authored Dec 7, 2017
2 parents dd7d04a + 64f8c33 commit 7ed5b36
Show file tree
Hide file tree
Showing 25 changed files with 77 additions and 61 deletions.
6 changes: 3 additions & 3 deletions _data/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,11 @@ merge-conflicts:
url: /merge-conflicts/mc-description/
- title: "Your First Conflict"
url: /merge-conflicts/first-conflict/
- title: "Bob's Simple Conflict"
- title: "Skatetocat's Simple Conflict"
url: /merge-conflicts/example-01/
- title: "Teddy, Mort, and Jimmy Help"
- title: "Shoptocat and Supportcat Help"
url: /merge-conflicts/example-02/
- title: "Gene and Louise Lend a Hand"
- title: "Momtocat and Poptocat Lend a Hand"
url: /merge-conflicts/example-03/
- title: "What Next?"
url: /merge-conflicts/what-next/
Expand Down
Binary file removed images/gifs/merge-conflict/config-merge.gif
Binary file not shown.
Binary file removed images/gifs/merge-conflict/exp-merge.gif
Binary file not shown.
Binary file added images/gifs/merge-conflict/first-example.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed images/gifs/merge-conflict/import-repo.gif
Binary file not shown.
Binary file removed images/gifs/merge-conflict/int-merge.gif
Binary file not shown.
Binary file added images/gifs/merge-conflict/mc-import.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/gifs/merge-conflict/normal-merge.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/gifs/merge-conflict/username-config.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/gifs/merge-conflict/username-education.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/master-new-feature-merge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
image: images/red-polo.png
imageAlt: The 'red polo' octocat, a cartoon of an octocat wearing a red polo
link: /windows
- title: Managing Merge Conflicts
description: First you had issues, now you have conflicts. Learn how to resolve at least one of them.
image: ./images/skatetocat.png
imageAlt: The 'skatetocat', a cartoon of an octocat using a skateboard and having fun
link: /merge-conflicts
- title: Git Out of Trouble
description: Quick guides to git out of sticky situations.
image: images/about/inspectocat.jpg
Expand Down
6 changes: 1 addition & 5 deletions paths/merge-conflict/00-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,12 @@ main-content: |
This course is designed for all of you. We demystify the merge conflict and, through a series of examples, prepare you to face off against the evil merge conflict and be the hero of the day!
![louise saying yes yes yes yes yes](https://media.giphy.com/media/xdeQFr16i4y64/giphy.gif)
In this course, we've created a few conflicts for you to resolve in a sample repository. This repository contains a [GitHub Pages](https://pages.github.com/) powered [resume](https://github.com/jglovier/resume-template). That means, when you finish this course, you'll have more than a few merge conflicts under your belt. You'll also have a shiny new resume.
Don't worry. When you're all done, we'll provide instructions for polishing your resume and getting it ready to share with others.
It's a good idea to complete a few other courses first, specifically the [Introduction to GitHub](../intro-to-github/), and either [GitHub Pages from GitHub Desktop](../github-desktop/) or [GitHub Pages from the Command Line](../github-cli/).
If you have any questions while taking the course, make sure to create an Issue in the primary [class repository](https://github.com/githubschool/on-demand-merge-conflict/issues).
As a token of appreciation for all of the laughs the Belchers have given some of the trainers here at GitHub, we are using them to cheer you on as you conquer merge conflicts. In no way, shape, or form, does FOX:tm: or Bob's Burgers:tm: endorse this course, GitHub Professional Services, or GitHub Inc.
If you have any questions while taking the course, make sure to create an Issue in the primary [class repository](https://github.com/githubtraining/on-demand-merge-conflict/issues).
---
8 changes: 6 additions & 2 deletions paths/merge-conflict/01-normal-merge.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@ header:
overlay_filter: rgba(46, 129, 200, 0.6)
title: A Normal Merge
permalink: /merge-conflicts/normal-merge/
next-page: /merge-conflicts/first-conflict/
next-page: /merge-conflicts/mc-description/
sidebar:
nav: "merge-conflicts"
main-content: |
Before we delve into the world of merge conflicts, we should discuss what a merge is normally doing. Let's say you take some commits from `new-feature` branch and merge them into `master`. Simply, you're applying the commits that you made on the `new-feature` branch to the `master` branch.
Before we delve into the world of merge conflicts, we should discuss what a merge is normally doing. Let's say you take some commits from the `new-feature` branch and merge them into `master`. The merge process applies the commits that you made on the `new-feature` branch to the `master` branch.
![example of new-feature merging into master](../../images/master-new-feature-merge.png)
It's common to merge a lot of branches with no problems before you encounter your first merge conflict. That's because Git is really smart when it comes merging. However, sometimes you and another collaborator both have an idea for a change to the same code, and Git needs you to examine the conflicting changes before it can successfully implement the changes.
Let's see a normal merge, and how it differs from a merge conflict.
[![creating a pull request](../../images/gifs/merge-conflict/normal-merge.gif)](../../images/gifs/merge-conflict/normal-merge.gif)
1. In your repository, create a new branch named `my-title`
1. In `_config.yml`, change lines 2-3 to give your resume a title, and a description.
1. Commit your changes.
Expand Down
23 changes: 12 additions & 11 deletions paths/merge-conflict/02-mc-desc.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ header:
overlay_filter: rgba(46, 129, 200, 0.6)
title: Merge Conflict Description
permalink: /merge-conflicts/mc-description/
next-page: /merge-conflicts/example-01/
next-page: /merge-conflicts/first-conflict/
sidebar:
nav: "merge-conflicts"
main-content: |
Expand All @@ -14,26 +14,27 @@ main-content: |
```
Name: First Last
Location: I Live Here
Favorite Animal: Octocat
Favorite Sports Team: Golden State Warriors
```
Now, let's imagine that Linda and Louise Belcher decide to change the default `Favorite Animal` in the template. So they might have something that looks like this:
Now, let's imagine that Matt and Briana decide to change the default `Favorite Sports Team` in the template. So they might have something that looks like this:
**Louise**
**Matt**
```
Favorite Animal: Kuchi Kopi
Favorite Sports Team: San Francisco Giants
```
**Linda**
![octocat dressed as a San Francisco Giants](https://octodex.github.com/images/wilson.jpg)
**Briana**
```
Favorite Animal: Akkorokamui
Favorite Sports Team: San Francisco 49ers
```
When **Louise** merges her changes into the deployment branch, she won't encounter a merge conflict.
![octocat dressed as a San Francisco 49er](https://octodex.github.com/images/goretocat.png)
![louise laughing over fire](https://media.giphy.com/media/dfIQG68floQuY/giphy.gif)
When **Matt** merges his changes into the deployment branch, he won't encounter a merge conflict.
However, when **Linda** tries to merge her changes into the deployment branch, she is going to encounter a merge conflict.
However, when **Briana** tries to merge her changes into the deployment branch, she is going to encounter a merge conflict.
![linda screaming](https://media.giphy.com/media/l0IyoieFSfr2Xcbza/giphy.gif)
---
6 changes: 3 additions & 3 deletions paths/merge-conflict/02-setup-repository.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ next-page: /merge-conflicts/normal-merge/
sidebar:
nav: "merge-conflicts"
main-content: |
To participate in this course, you're going to need to **import** a project from the [GitHub School organization](https://github.com/githubschool). Importing a project will essentially copy the repository -- including all of the files, branches and history to your account.
To participate in this course, you're going to need to **import** a project from the [GitHub Training organization](https://github.com/githubtraining). Importing a project will essentially copy the repository -- including all of the files, branches, and history to your account.
[![instructions for using the repository import tool](../../images/gifs/merge-conflict/import-repo.gif)](../../images/gifs/merge-conflict/import-repo.gif)
[![instructions for using the repository import tool](../../images/gifs/merge-conflict/mc-import.gif)](../../images/gifs/merge-conflict/mc-import.gif)
1. While logged into GitHub, navigate to the [Import tool](https://github.com/new/import).
1. In the **Your old repository's clone URL** field, enter:
https://github.com/githubschool/on-demand-merge-conflict.git
https://github.com/githubtraining/on-demand-merge-conflict.git
1. Ensure that the **Owner** field is your account.
1. In the **Name** field, enter a new name for your repository. Since this course not only teaches you about merge conflicts but also provides a GitHub Pages powered resume template, maybe something like `resume` would work.
1. Select **Public** under the privacy options.
Expand Down
12 changes: 10 additions & 2 deletions paths/merge-conflict/02-your-first-conflict.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,26 @@ header:
overlay_filter: rgba(46, 129, 200, 0.6)
title: Your First Conflict
permalink: /merge-conflicts/first-conflict/
next-page: /merge-conflicts/mc-description/
next-page: /merge-conflicts/example-01/
sidebar:
nav: "merge-conflicts"
main-content: |
You're here to learn about conflicts! So let's get conflicted.
[![walkthrough of a merge conflict](../../images/gifs/merge-conflict/first-example.gif)](../../images/gifs/merge-conflict/first-example.gif)
1. Check out to the `master` branch.
1. In `_config.yml`, change lines 2-3 again to update your resume's title, and description. Ensure your changes are different from those in step 2 from the previous page of instructions.
1. Return to your Pull Request. A conflict now appears because `my-title` is based on a previous point in history, and new commits override our proposed change. Let's solve this, our first conflict. Click on **Resolve conflict**.
1. Remove the conflict markers and choose your desired title.
> To dive into all of the odd symbols on your screen, check out the **Tell me why** section.
1. Click **Mark as resolved**.
1. Your Pull Request is now free of conflicts. Press the big green button to merge your pull request!
1. Click **Commit merge**.
1. Your Pull Request is now free of conflicts. Click **Merge pull request** to merge your pull request!
tell-me-why:
includes:
- /tell-me-why/merge-conflict.md
---
26 changes: 10 additions & 16 deletions paths/merge-conflict/04-ex-01.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,33 @@ layout: simple-class
header:
overlay_image: cover.jpeg
overlay_filter: rgba(46, 129, 200, 0.6)
title: Bob's Simple Conflict
title: Skatetocat's Simple Conflict
permalink: /merge-conflicts/example-01/
next-page: /merge-conflicts/example-02/
sidebar:
nav: "merge-conflicts"
main-content: |
We need to modify the resume template so it contains our information. Using the GitHub Flow, we can make those changes by:
We need to modify the resume template so it contains our information. Using the [GitHub Flow](https://guides.github.com/introduction/flow/), we can make those changes by:
[![instructions for this activity](../../images/gifs/merge-conflict/config-merge.gif)](../../images/gifs/merge-conflict/config-merge.gif)
[![instructions for this activity](../../images/gifs/merge-conflict/username-config.gif)](../../images/gifs/merge-conflict/username-config.gif)
1. In your imported version of the repository, checkout to the branch named: `username-config`.
1. While on that branch, open the `_config.yml` file.
1. Lines 12-19 should be modified with your information. If you would prefer to create a fictional resume, your favorite fictional character's information.
1. Modify lines 12-19 with your information. If you would prefer to create a fictional resume, your favorite fictional character's information.
1. After making the changes, create a commit, an example commit message might be: `Add my information`.
> If you made the changes on your local machine, push your changes back to repository on GitHub.
1. Create a new pull request. Use the **base:** of `master` and the **compare:** of `username-config`.
1. Although GitHub reports that you can't automatically merge these changes, you can still start the pull request. Click **Create pull request**.
1. In the **This branch has conflicts that must be resolved** section of the pull request, click the **Resolve conflicts** button to resolve the merge conflict.
1. It would appear that Bob Belcher recently made changes to the `master` branch and modified the exact same line you did, this is what caused the merge conflict to occur. Click "Resolve conflicts", and remove Bob's contributions to the `gh-pages` branch by deleting all of the content below the `=======` and above the `>>>>>>> gh-pages` content.
1. It would appear that Skatetocat recently made changes to the `master` branch and modified the exact same line you did, this is what caused the merge conflict to occur. Click "Resolve conflicts", and remove Skatetocat's contributions to the `master` branch by deleting all of the content below the `=======` and above the `>>>>>>> master` content.
> To dive into all of the odd symbols on your screen, check out the **Tell me why** section.
![Skatetocat](https://octodex.github.com/images/skatetocat.png)
![bob saying we are radically off plan](https://media.giphy.com/media/ZUShN4lbUvAt2/giphy.gif)
1. We still can't mark as resolved because we need to remove the merge conflict markers. Delete the following lines: `<<<<<<< username-config`, `=======`, and `>>>>>>> gh-pages`.
1. With the merge conflict markers removed, click **Mark as resolved**. Congratulations, you successfully resolved a merge conflict! Go ahead and merge the pull request.
![bob belcher excited about your progress](https://media.giphy.com/media/26ufhng4a2DRC5huw/giphy.gif)
tell-me-why:
includes:
- /tell-me-why/merge-conflict.md
1. We still can't mark as resolved because we need to remove the merge conflict markers. Delete the following lines: `<<<<<<< username-config`, `=======`, and `>>>>>>> master`.
1. With the merge conflict markers removed, click **Mark as resolved**.
1. Click **Commit merge**.
1. Congratulations, you successfully resolved a merge conflict! Go ahead and merge the pull request.
---
21 changes: 13 additions & 8 deletions paths/merge-conflict/05-ex-02.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ layout: simple-class
header:
overlay_image: cover.jpeg
overlay_filter: rgba(46, 129, 200, 0.6)
title: Teddy, Mort, and Jimmy Help
title: Shoptocat and Supportcat Help
permalink: /merge-conflicts/example-02/
next-page: /merge-conflicts/example-03/
sidebar:
Expand All @@ -12,27 +12,32 @@ main-content: |
Since we customized the resume to include our information, we should include our current professional experience. To include our experience we need to modify the `experience.yml` file.
[![instructions for this activity](../../images/gifs/merge-conflict/exp-merge.gif)](../../images/gifs/merge-conflict/exp-merge.gif)
[![instructions for this activity](../../images/gifs/merge-conflict/username-experience.gif)](../../images/gifs/merge-conflict/username-experience.gif)
1. In your imported version of the repository, checkout to the branch named: `username-experience`.
1. While on that branch, open the `_data/experience.yml` file.
1. Modify on the content on lines 2 through 6 making sure to provide information in the `company`, `position`, `duration`, and `summary` lines.
1. Save your changes to the `experience.yml` file and create a new commit.
1. Modify the content on lines 2 through 6 and 15 through 19 making sure to provide information in the `company`, `position`, `duration`, and `summary` lines.
> Later you can go back and modify the `experience.yml` to be consistent with your experience.
1. After making the changes, create a commit, an example commit message might be: `Add my experience`.
> If you made the changes on your local machine, push your changes back to repository on GitHub.
1. Create a new pull request. Use the **base:** of `master` and the **compare:** of `username-experience`.
1. Click **Create pull request**.
1. In the **This branch has conflicts that must be resolved** section of the pull request, click the **Resolve conflicts** button to resolve the merge conflict.
1. It would appear that Teddy, Mort, and Jimmy Pesto recently made changes to the `master` branch and modified the same file you did, this is what is causing the merge conflicts. Similar to when we had to resolve a merge conflict with Bob's changes, remove Teddy, Mort, and Jimmy's contributions from the `experience.yml` file. If you need a refresher on how to resolve a merge conflict, check the **I need a refresher** section below.
1. It would appear that Shoptocat and Supportcat recently made changes to the `master` branch and modified the same file you did, this is what is causing the merge conflicts. Similar to when we had to resolve a merge conflict with Mummytocat's changes, remove Shoptocat and Supportcat's contributions from the `experience.yml` file. If you need a refresher on how to resolve a merge conflict, check the **I need a refresher** section below.
> In the video instructions above, you might notice that @beardofedu ran into 2 conflicts in the same file. That is because they edited lines 2 - 6 and 15 - 19, so Git identified the two changes within the file as two separate conflicts. Had they edited lines 2 - 19, it would have been one merge conflict.
![teddy holding his eyes](https://media.giphy.com/media/3oKIP8IA2LPwJGFC4U/giphy.gif)
![shoptocat](https://octodex.github.com/images/shoptocat.png)
1. With the merge conflict markers removed, click **Mark as resolved** and merge your pull request.
1. With the merge conflict markers removed, click **Mark as resolved**
1. Click **Commit merge**.
1. With the merge conflicts resolved, click **Merge pull request**.
![teddy dancing](https://media.giphy.com/media/xT8qB6JscNB2d4HX3i/giphy.gif)
![supportcat](https://octodex.github.com/images/supportcat.png)
refresh: |
Expand Down
16 changes: 9 additions & 7 deletions paths/merge-conflict/06-ex-03.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ layout: simple-class
header:
overlay_image: cover.jpeg
overlay_filter: rgba(46, 129, 200, 0.6)
title: Gene and Louise Lend a Hand
title: Momtocat and Poptocat Lend a Hand
permalink: /merge-conflicts/example-03/
next-page: /merge-conflicts/ide-intro/
next-page: /merge-conflicts/what-next/
sidebar:
nav: "merge-conflicts"
main-content: |
So, our resume is slowly taking shape, after modifying the contact information in the `_config.yml` file, we turned our attention to the `experience.yml` file. To wrap up, we need to finish adding our education and interests to the resume.
[![instructions for this activity](../../images/gifs/merge-conflict/int-merge.gif)](../../images/gifs/merge-conflict/int-merge.gif)
[![instructions for this activity](../../images/gifs/merge-conflict/username-education.gif)](../../images/gifs/merge-conflict/username-education.gif)
1. In your imported version of the repository, checkout to the branch named: `username-education`.
1. While on that branch, open the `_data/education.yml` file.
Expand All @@ -29,12 +29,14 @@ main-content: |
1. Create a new pull request. Use the **base:** of `master` and the **compare:** of `username-education`.
1. Click **Create pull request**.
1. In the **This branch has conflicts that must be resolved** section of the pull request, you can click the **Resolve conflicts** button to resolve the merge conflict.
1. It would appear that Gene and Louise Belcher recently made changes to the `master` branch and modified the same files you did, this is what is causing the merge conflicts. Similar to when we had to resolve a merge conflict with Bob's changes, remove Gene's contributions from the `education.yml` and Louise's contributions from the `interests.yml` files.
1. It would appear that Momtocat and Poptocat recently made changes to the `master` branch and modified the same files you did, this is what is causing the merge conflicts. Similar to when we had to resolve a merge conflict with Skatetocat's changes, remove Momtocat's contributions from the `education.yml` and Poptocat's contributions from the `interests.yml` files.
![gene and louise saying its a crisis](https://media.giphy.com/media/l0HFjUCsgWTmmUMDK/giphy.gif)
![momtocat](https://octodex.github.com/images/momtocat.png)
1. With the merge conflict markers removed, click **Mark as resolved** and merge your pull request.
1. With the merge conflict markers removed, click **Mark as resolved**
1. Click **Commit merge**.
1. With the merge conflicts resolved, click **Merge pull request**.
![gene trying to rip shirt](https://media.giphy.com/media/GVYVYgGCl8fVC/giphy.gif)
![poptocat](https://octodex.github.com/images/poptocat.png)
---
Loading

0 comments on commit 7ed5b36

Please sign in to comment.