Skip to content

Commit 5b37532

Browse files
committed
improving readme
1 parent fe092e1 commit 5b37532

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

README.md

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ A workflow like this is nice because you can easily undo if you realize the chan
2323

2424
Part 1: Making a Change Using Branches
2525
===================
26-
In part 1 of this assignment, you're going to do exactly what you did in your first Git assignment, using a branch.
26+
In part 1 of this assignment, you're going to do exactly what you did in your first Git assignment, but using a branch.
2727

2828
In your first Git assignment, there was one branch: gh-pages. You made your change on that branch (in Sublime), committed (saved) to that branch (`git commit`), and pushed that branch to GitHub (`git push origin gh-pages`).
2929

3030
In this assignment, we're going to make a new branch called "add-my-name" and make our change to that copy. When we're done, we'll commit it (to "add-my-name") and then merge add-my-name back into gh-pages to send to GitHub.
3131

32-
1. Clone the repository at https://github.com/adamaflynn/MergingAssignment
33-
2. See what branch we're on: `git branch` (the * beside gh-pages means we're on that branch; ignore add-adams-name until part 2)
32+
1. Fork the repository at https://github.com/adamaflynn/MergingAssignment and clone your copy
33+
2. See what branch we're on: `git branch` (the * beside gh-pages means we're on that branch)
3434
3. Make a new branch: `git checkout -b add-my-name` (the `-b` means "make a new branch")
3535
4. Now see what branch we're on: `git branch` (you'll see 2 branches, with the * beside add-my-name)
3636
5. Open Sublime, change index.html to use your first name
@@ -49,31 +49,32 @@ In this assignment, we're going to make a new branch called "add-my-name" and ma
4949
Part 2: Merge Conflicts
5050
===================
5151

52-
In part 1, we looked at an example where everything goes smoothly. But this isn't always the case. Imagine that there are 2 people working on this project (or you're working on 2 different branches at once). What would happen if both people tried to change the webpage to their own name and merge? If Mr. Simon and Adam were partners, Adam changed the title to "Adam's Sample Assignment" and merged, then Mr. Simon changed it to "Mr. Simon's Sample Assignment" and merged, Git wouldn't know what to do!
52+
In part 1, we looked at an example where everything goes smoothly. But this isn't always the case. Imagine that there are 2 people working on this project (or you're working on 2 different branches at once). What would happen if both people tried to change the webpage to their own name and merge? If Mr. Simon and Adam were partners, Adam changed the title to "Adam's Sample Assignment", then Mr. Simon changed it to "Mr. Simon's Sample Assignment", Git wouldn't know what to do!
5353

5454
So what does Git do? Well, it asks for help. It tells you what files it's confused about and lets you decide what the right thing to do is.
5555

5656
This happens all the time in real software projects. If you have 20, 50, 100, or 1000 developers all working on the same repository all day, you're bound to accidentally touch the same things at the same time. I usually handle a couple merge conflicts a day.
5757

5858
To make things easy, I made a branch in this repository (add-adams-name) that has my name on it. After finishing part 1, if you try to merge add-adams-name into gh-pages, you'll have a merge conflict (since you already added your name). We'll look at how to fix that.
5959

60-
1. Make sure you're on the gh-pages branch (how do we do this, again?)
61-
2. Try to merge add-adams-name: `git merge add-adams-name`
62-
3. Git will say there's a conflict
63-
4. Take a look at what files it's confused about: `git status`
64-
5. You'll see index.html has a conflict, open it up in Sublime
65-
6. Find lines like `<<<<<<<<<`, `===========`, and `>>>>>>>>>`. They show you the 2 versions Git has to choose from.
66-
7. Decide how to fix the file. Maybe it's one or the other. Maybe it's a combination: if we were partners, you could change it to show both our names!
67-
8. Test that change to make sure it works
68-
9. "Stage" the file that you fixed
69-
10. Type `git commit -m "Fixing merge conflict"`
70-
11. Push the fixed gh-pages branch to GitHub
71-
12. Check it out in github.io to make sure it works
60+
1. Add the add-adams-name branch from GitHub: `git branch add-adams-name origin/add-adams-name`
61+
2. Make sure you're on the gh-pages branch (how do we do this, again?)
62+
3. Try to merge add-adams-name: `git merge add-adams-name`
63+
4. Git will say there's a conflict
64+
5. Take a look at what files it's confused about: `git status`
65+
6. You'll see index.html has a conflict, open it up in Sublime
66+
7. Find lines like `<<<<<<<<<`, `===========`, and `>>>>>>>>>`. They show you the 2 versions Git has to choose from.
67+
8. Decide how to fix the file. Maybe it's one or the other. Maybe it's a combination: if we were partners, you could change it to show both our names!
68+
9. Test that change to make sure it works
69+
10. "Stage" the file that you fixed
70+
11. Type `git commit -m "Fixing merge conflict"`
71+
12. Push the fixed gh-pages branch to GitHub
72+
13. Check it out in github.io to make sure it works
7273

7374
Quick Reference
7475
============
7576

76-
See what branch you're on: `git branch`
77-
Make a new branch: `git checkout -b some-branch-name`
78-
Delete a branch: `git branch -d some-branch-name`
79-
Merge a branch onto the branch you're on: `git merge some-other-branch`
77+
* See what branch you're on: `git branch`
78+
* Make a new branch: `git checkout -b some-branch-name`
79+
* Delete a branch: `git branch -d some-branch-name`
80+
* Merge a branch onto the branch you're on: `git merge some-other-branch`

0 commit comments

Comments
 (0)