Github - how to resolve conflicts

My friend and I are trying to work on an iPhone project, but you have a problem managing version conflicts with github.

Example. We are both working on a specific line of code with xCode 4.2 (and the github mac client)

int majorVersion = 0; 

1) It changes the code to int majorVersion = 999; makes changes; syncs - no problem, end on github

2) At the same time, I change the code to int majorVersion = 666; then:

  • I commit changes
  • conflict - I select my specific version by selecting a line of code ( int majorVersion = 666; )
  • in xCode, I delete the funny <<<<HEAD (so that only int majorVersion = 666; remains)
  • commit changes
  • finally: I'm trying to post a branch, but I get the following error:

Error: it is not possible to click on an unqualified address: HEAD The purpose of refspec does not match the existing link on the remote control and does not start with refs /, and we cannot guess the prefix based on the source code ref. Error: Failed to click multiple links to ' https://github.com/XXX/XXX.git '

What are we doing wrong? Is the main problem that I deleted the funny <<<<and HEAD declaration in xCode (see screenshot below)? How should we deal with such conflicts?

enter image description here

+4
source share
1 answer

There are currently no branches. do nothing (working directory is clean)
(as shown in this example )

This means that you are in the DETACHED HEAD , and the permissions (git log, git reflog, ...) are mentioned in " There is currently no branch + git commit + checkout when it is not in any branch. I lost your changes? "

The problem is not in the modification itself, but how you first checked your code in Xcode4: any verification of the tag or SHA1 will lead to a situation with a separate head.

See also the resolution proposed in " Git Checkout returned code for an older commit, how to go back? "

+1
source

Source: https://habr.com/ru/post/1383736/


All Articles