File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 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 ` .
You can’t perform that action at this time.
0 commit comments