tags:

views:

120

answers:

3

How do I fix the following?

<<<<<<< HEAD
<<<<<<< HEAD
-(int)existsMedia:(NSNumber*)mediaId {
 NSFetchRequest *request = [[NSFetchRequest alloc] init];
 NSPredicate *predicate = [NSPredicate predicateWithFormat:[NSString stringWithFormat:@"mediaId == %@", mediaId]];
=======
-(int)existsMedia:(NSNumber*)mediaMessageId {
 NSFetchRequest *request = [[NSFetchRequest alloc] init];
 NSPredicate *predicate = [NSPredicate predicateWithFormat:[NSString stringWithFormat:@"messageId == %@", mediaMessageId]];
>>>>>>> dc244e93b3e351ab6dce5785e1f2b686305a0051
=======
-(int)existsMedia:(NSNumber*)mediaMessageId {
 NSFetchRequest *request = [[NSFetchRequest alloc] init];
 NSPredicate *predicate = [NSPredicate predicateWithFormat:[NSString stringWithFormat:@"messageId == %@", mediaMessageId]];
>>>>>>> parent of 4a5c497... Bug Hunting for Media Support
 NSEntityDescription *entity = [NSEntityDescription entityForName:@"ELMMedia" inManagedObjectContext:managedObjectContext];
 [request setEntity:entity];
 [request setPredicate:predicate];
 NSError *error;
 NSUInteger count = [managedObjectContext countForFetchRequest:request error:&error];

 [request release];

Actually, yes, there was a merge. But I don't know why. Is it possible to get my correct commit on 00:25?

alt text

+2  A: 

Git found a merge conflict and modified the files in question to point out where the conflict is.

Edit the files resolve the merge, save, and commit them.

More info:


Edit

You say you didn't perform a merge, but a git pull includes a merge: based on your tree, it looks like you made changes to your local repository using an out-of-date copy. When you pulled the remote repository, it initiated a merge.

Resolving a merge is merely a matter of editing the files to look the way you want them to and re-committing, and is a standard part of SCM.

Mark Trapp
Well, the question is, how can my remote repo be out of date, when I'm the only one commiting to it Oo
Henrik P. Hessel
You were working off the wrong branch when you committed "Converted from Voice to more general Media Typ...". This happens from time to time if you're not careful, and the merge conflict being thrown is what prevents you from losing changes. You can always confirm you're on the right branch by doing `git status`.
Mark Trapp
Thanks, but I still have on branch setup. I'm confused.
Henrik P. Hessel
Look at your tree: you have two different branches (identified by the tags next to the top commit): `master` and `origin/master`. After the "Storage manager cleanup" branch, you made two commits to one, and one commit to the other. The topmost commit is the merge, which was initiated when you did something: either you did `git merge` or you did `git pull`.
Mark Trapp
+1  A: 

Run git mergetool (assuming you set your mergetool tool in .gitconfig). It'll launch whatever tool you want to solve the problem.

mathepic
+1  A: 

Your problem is that you have pushed a commit to your remote repository, then amended it locally, made another commit and then pulled.

Because the remote repository contains an old 'version' of your amended commit, your new local commit is not a direct descendant of the remote branch. This means that pull will trigger a non-trivial (i.e. non fast forward) merge of the two branches. The old commit on the remote side and the amended commit that you have locally affect change the same areas of the same files so you have conflicts.

Assuming that you haven't (or don't mean to have) any local changes and that you want your most recent real commit ("Bug Hunting for Media Support") to be the head of the master branch you can undo the merge attempt like this.

I'm not 100% sure of you diagram, I believe that it means that you are attempting a merge but that you haven't made the merge commit yet. If so run this (be warned, this throws away local changes):

git reset --hard

If you have committed the merge (i.e. "-" is actually the commit message) then you would have to run git reset --hard HEAD^ instead.

After this your local master should be at the old commit.

If this is successdul, in order to get your remote repository correct, you will need to force the push. (This is usually not recommended but as you say that you are the only person using your repository it's OK.)

You should try this:

git push -f origin master

If this doesn't work (e.g. if the remote has denyNonFastForward set) you will have to resort to alternative means. See here for details of how to get around this.

Charles Bailey
Okay, learned a lot. Thanks Charles.
Henrik P. Hessel