n.evermind
n.evermind

Reputation: 12004

Github - how to solve conflicts

My friend and I are trying to work on an iPhone project, but have a problem with version conflict management using github.

Example: Both of us are working on a certain line of code with xCode 4.2 (and the github mac client)

int majorVersion = 0;

1) He changes the code to int majorVersion = 999; commits changes; syncs - no problems, will end up in github

2) Simultaneously, I change the code to int majorVersion = 666; then:

error: unable to push to unqualified destination: HEAD The destination refspec neither matches an existing ref on the remote nor begins with refs/, and we are unable to guess a prefix based on the source ref. error: failed to push some refs to 'https://github.com/XXX/XXX.git'

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

enter image description here

Upvotes: 4

Views: 5084

Answers (1)

VonC
VonC

Reputation: 1328322

Not currently on any branch. nothing to commit (working directory clean)
(as seen in this example)

That means you are in a DETACHED HEAD, and resolutions (git log, git reflog, ...) are mentioned in "Not currently on any branch + git commit + checkout when not in any branch. Did i loose my changes?".

The problem isn't the concurrent modification in itself, but rather how you did checkout your code in XCode4 in the first place: any checkout of a tag or a SHA1 would result in a detached head situation.

See also the resolution proposed in "Git Checkout reverted code to older commit, how to revert back?".

Upvotes: 1

Related Questions