Skip to content

Commit 4d9fe11

Browse files
committed
Add page on handling merge conflicts
1 parent cbf2b03 commit 4d9fe11

2 files changed

Lines changed: 37 additions & 2 deletions

File tree

index.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ minimal guide to get started.
1919
- [Start a new repository](pages/init.html): from scratch, or with an
2020
existing project.
2121
- [Contribute to someone's repository](pages/fork.html)
22-
- A package I'm using has a bug but I can't figure out how to fix it
22+
- [Handling merge conflicts](merge_conflicts.html)
2323
- Oops; that last commit message was wrong
24-
- Merge conflicts
2524
- Exploring the code and its history
2625
- Resources
2726

pages/merge_conflicts.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
layout: page
3+
title: Handling merge conflicts
4+
---
5+
6+
One of the best features of [git](http://git-scm.com) is its ability
7+
to easily merge multiple changes by different people.
8+
9+
Say you and a
10+
friend have both made changes to the same file at the same time.
11+
When you pull your friend's changes, git will often be able to combine
12+
them without any problem.
13+
14+
Sometimes, though, after you do
15+
16+
$ git pull myfriend master
17+
18+
You'll get a message like
19+
20+
Auto-merging README.md
21+
CONFLICT (content): Merge conflict in README.md
22+
Automatic merge failed; fix conflicts and then commit the result.
23+
24+
If open the offending file in a text editor, you'll find an indication
25+
of the bits that are different, something like this:
26+
27+
<<<<<<< HEAD
28+
A line in my file.
29+
=======
30+
A line in my friend's file
31+
>>>>>>> 031389f2cd2acde08e32f0beb084b2f7c3257fff
32+
33+
Edit the bits from `<<<<<<<` to `>>>>>>>`, to make the file just as
34+
you want it
35+
36+
Then do `git add`, `git commit`, and `git push`.

0 commit comments

Comments
 (0)