-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the Cookies-and-Code-Git wiki!
For a more comprehensive guide to git, check out the Pro Git book online.
A merge conflict will typically occur when you attempt to push to the master branch on the origin server. Below are the basic steps to resolving merge conflicts. For full detailed information, refer to the "Basic Merge Conflicts" section in Chapter 3.2: Basic Branching and Merging of the Pro Git book.
- To see which files have merge conflicts, run
git status
- Open up the listed file(s) and find the sections of the code that contain symbols that look like the following:
<<<<<<< HEAD:index.html
<div id="footer">contact : [email protected]</div>
=======
<div id="footer">
please contact us at [email protected]
</div>
>>>>>>> iss53:index.html
The top portion of the code above the =======
is what's in your current working directory. The bottom portion of the code is what's already been pushed to the server.
-
Choose the code you want (i.e., the top portion, bottom portion, or some combination of both) and remove all
<<<<<<<
,=======
, and>>>>>>>
symbols. -
From here, save your file and run
git add [filename]
to indicate that the merge conflict has been resolved for that file -
You can run
git status
again to ensure that there are no more conflicts -
Then run
git commit -m "message"
to commit your changes -
Push to the remote repository using
git push origin master