Skip to content

Commit 3335a22

Browse files
authored
Merge branch 'main' into main
2 parents 6923a0d + 6111189 commit 3335a22

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

forking_workflow.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,40 @@ On the "Source Control" tab, pull from `upstream`:
139139
![18_vscode_fetchupstream2](https://user-images.githubusercontent.com/91637560/176327658-91156793-9ee5-4526-a5ae-d470704ca1ff.png)
140140

141141
Your local repo is now up-to-date with the "Parent" repo. Sync these changes to make your remote repo up-to-date with "Parent" as well.
142+
143+
## 7. (Potentially) Resolve merge conflicts
144+
Merge conflicts arise when Git doesn't know how to reconcile conflicting changes occuring on the same file. In these situations, Git leaves it to the user to figure out how to best resolve the conflicting changes.
145+
For this example, to create a merge conflict, navigate to your local repo and run:
146+
```
147+
git pull upstream patrick_branch
148+
```
149+
Don't worry too much about the specifics of this command for now. You should see some text:
150+
```
151+
Auto-merging some_file.txt
152+
CONFLICT (content): Merge conflict in some_file.txt
153+
Automatic merge failed; fix conflicts and then commit the result.
154+
```
155+
Opening up some_file.txt in any text editor, you should see something like:
156+
```
157+
This file contains some text
158+
Some change katherine has made
159+
Another change katherine has made
160+
Some change patrick has made
161+
```
162+
The text within the `<<<<<<<` and the `>>>>>>>` are the conflicting areas.
163+
Anything between `<<<<<<< HEAD` and `=======` represent what you had in the file, before trying to merge in any new changes.
164+
Anything between `=======` and `>>>>>>>` represent what the incoming changes are.
165+
You can choose to accept what you had, the incoming changes, both, or a mixture of the two.
166+
For our example, let's choose to accept both, so remove the any lines with `<<<<<<< HEAD`, `=======` and `>>>>>>>`
167+
Your file should now look like:
168+
```
169+
This file contains some text
170+
Some change katherine has made
171+
Another change katherine has made
172+
Some change patrick has made
173+
```
174+
Now, to finish up the merge, we need to add/commit our changes.
175+
```
176+
git add . && git commit -m "resolve merge conflict, keep both changes"
177+
```
178+
Your merge conflict has been successfully resolved!

0 commit comments

Comments
 (0)