GITHUB Conflict Resolving

给你一囗甜甜゛ 提交于 2019-12-03 11:14:46

If you press the sync button, you'll be pulling changes your friends made and pushed online. If changes don't merge cleanly, you'll be prompt that a conflict occurred. This will add conflicts line into your files where you'll have to go and resolve them. After that, you'll only need to commit the changes.

The conflicted lines should appear in the Github for Windows interface (although I'm not 100% sure, I actually prefer resolving conflict through the command line).

By command line, you'll have to enter command as so:

git pull
# If merge conflict, you'll be prompt to resolve them, git will list conflicted files
# Open those files in you editor and resolve conflicts. Line will be marked in the files.
# When all is resolved :
git add -A
git commit
# No need to enter a message, git will automatically fill the message with
# merge conflict specific information
git push

In your files, the conflict marker will look something like this:

<<<<<<<<<<< [sha-1 of the commit]
function() {
==================
function( hey ) {
HEAD>>>>>>>>>>>>>

In my case, it just turned out that I neglected to sync a previous commit before attempting to sync the next one.

No conflict resolution necessary.

I also found it interesting that all the difference blocks

<<<<<<<<<<<<<<<<<...
...
======================
...
HEAD>>>>>>>>>>>>>>

are actually placed into your source code. Just open the conflicted file in a text editor and keep/delete the desired branch.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!