Skip to content

Commit 995c9ba

Browse files
authored
Merge pull request #61 from UofT-DSI/gvwilson-modifications
feat: updating material on handling merge conflicts
2 parents a369c29 + 636719b commit 995c9ba

2 files changed

Lines changed: 34 additions & 21 deletions

File tree

01_materials/05_git_merge_conflicts.md

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
```bash
66
git clone https://github.com/gvwilson/team-playlist.git
7-
cd team-playlist-demo
7+
cd team-playlist
88
```
99

1010
---
@@ -19,8 +19,8 @@ git branch -a
1919

2020
You should see:
2121
- `main` (your current branch)
22-
- `remotes/origin/Max-song-change`
23-
- `remotes/origin/Em-song-change`
22+
- `remotes/origin/max-changes`
23+
- `remotes/origin/em-changes`
2424

2525
### View the current playlist
2626
```bash
@@ -36,7 +36,7 @@ This is the original playlist that both Max and Em will modify.
3636
### Merge Max's branch into main
3737
```bash
3838
# Merge Max's changes
39-
git merge origin/Max-song-change
39+
git merge origin/max-changes
4040
```
4141

4242
**Success!** This merge works smoothly.
@@ -55,7 +55,7 @@ Notice how the playlist has been updated with Max's song choice.
5555
### Try to merge Em's branch
5656
```bash
5757
# Try to merge Em's changes
58-
git merge origin/Em-song-change
58+
git merge origin/em-changes
5959
```
6060

6161
💥 **CONFLICT!** Git displays an error message:
@@ -65,7 +65,7 @@ CONFLICT (content): Merge conflict in playlist.txt
6565
Automatic merge failed; fix conflicts and then commit the result.
6666
```
6767

68-
**What happened?** Both Max and Em edited the same line. Git doesn't know which version to keep!
68+
**What happened?** Both Max and Em edited the same lines. Git doesn't know which version to keep.
6969

7070
---
7171

@@ -86,18 +86,24 @@ cat playlist.txt
8686
**What you'll see:**
8787
```
8888
<<<<<<< HEAD
89-
Song 5: Blinding Lights - The Weeknd
90-
Last updated: Tuesday by Max
89+
Song 5: Hard Sun - Gordon Peterson
90+
Song 6: Constant Craving - k.d. lang
91+
92+
Total songs: 6
93+
Last updated: Tuesday
9194
=======
92-
Song 5: Levitating - Dua Lipa
95+
Song 5: Hard Sun - Eddie Vedder
96+
Song 6: Hand in My Pocket - Alanis Morissette
97+
98+
Total songs: 6
9399
Last updated: Tuesday by Em
94-
>>>>>>> origin/Em-song-change
100+
>>>>>>> origin/em-changes
95101
```
96102

97103
**Understanding conflict markers:**
98104
- `<<<<<<< HEAD` - Current version (Max's change, already in main)
99105
- `=======` - Separator between the two versions
100-
- `>>>>>>> origin/Em-song-change` - Incoming version (Em's change)
106+
- `>>>>>>> origin/em-changes` - Incoming version (Em's change)
101107

102108
---
103109

@@ -108,23 +114,30 @@ Open `playlist.txt` in your text editor and choose ONE of these options:
108114

109115
**Option 1: Keep Max's version**
110116
```
111-
Song 5: Blinding Lights - The Weeknd
112-
Last updated: Tuesday by Max
117+
Song 5: Hard Sun - Gordon Peterson
118+
Song 6: Constant Craving - k.d. lang
119+
120+
Total songs: 6
121+
Last updated: Tuesday
113122
```
114123

115124
**Option 2: Keep Em's version**
116125
```
117-
Song 5: Levitating - Dua Lipa
126+
Song 5: Hard Sun - Eddie Vedder
127+
Song 6: Hand in My Pocket - Alanis Morissette
128+
129+
Total songs: 6
118130
Last updated: Tuesday by Em
119131
```
120132

121-
**Option 3: Keep both songs!**
133+
**Option 3: Keep both!**
122134
```
123-
Song 5: Blinding Lights - The Weeknd
124-
Song 6: Levitating - Dua Lipa
135+
Song 5: Hard Sun - Gordon Peterson
136+
Song 6: Constant Craving - k.d. lang
137+
Song 7: Hand in My Pocket - Alanis Morissette
125138
126-
Total songs: 6
127-
Last updated: Tuesday by Team
139+
Total songs: 7
140+
Last updated: Tuesday by Max and Em
128141
```
129142

130143
**Important:** Delete ALL conflict markers (`<<<<<<<`, `=======`, `>>>>>>>`)
@@ -145,7 +158,7 @@ git status
145158
### Commit the merge
146159
```bash
147160
# Complete the merge with a commit
148-
git commit -m "Merge Em-song-change: resolved playlist conflict"
161+
git commit -m "Merge em-changes: resolved playlist conflict"
149162
```
150163

151164
### View the merge in history

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Participants should review the [Assignment Submission Guide](https://github.com/
5050
* **Greg Wilson** gvwilson@third-bit.com
5151

5252
* Learning Support Staff:
53-
* **Dmytro Bonislavskyi** dmytro.bonislavskyi@gmail.com
53+
* **Dmytro Bonislavskyi** dmytro.bonislavskyi@gmail.com / Dmytro-Bonislavskyi
5454
* **Sergii Khomych** svkhomich1@gmail.com / khsergvl
5555
* **Anjali Shrivastava** anju_shrivastava@yahoo.com / anjali-deshpande-hub
5656

0 commit comments

Comments
 (0)