Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed Xcode Git Merge is stuck

Tags:

We have a git based project with a friend and one master branch. He made some changes to some files, I made changes to some other files, and we may, most probably did, make changes to a couple of the same files. He committed and pushed all of his changes to the repo. Then I went and committed my changes and tried to pull his changes. I was presented with a few conflicts which I mostly resolved in favor of his changes because they were files I did not change. Then when I tried to push, I got a fatal: cannot do a partial commit during a merge.

These are the screens I get.showing the files with source control status

The window when i try to commit

The error message

What can I do? The project runs fine except that the main menu of the game isn't showing the images its supposed to, which are the ones he was working on and the class files he worked on, aside from a couple of other ones.

like image 395
marciokoko Avatar asked May 13 '12 00:05

marciokoko


People also ask

How do you force quit a merge?

Use git-reset or git merge --abort to cancel a merge that had conflicts. Please note that all the changes will be reset, and this operation cannot be reverted, so make sure to commit or git-stash all your changes before you start a merge.

How do you abort a failed merge?

On the command line, a simple "git merge --abort" will do this for you. In case you've made a mistake while resolving a conflict and realize this only after completing the merge, you can still easily undo it: just roll back to the commit before the merge happened with "git reset --hard " and start over again.

Why does git merge fail?

An Automatic Merge Failure occurs whenever there are competing changes made to the same line by two developers, or when one developer is working on a file and another developer deletes it. Merge conflicts are relatively common whenever you commit. It is essential to identify and resolve conflicts.


1 Answers

This is a common frustrating situation:

  1. Open the terminal
  2. Go to your project repository folder (the one containing the .git hidden file)
  3. Move your merge head aside typing mv .git/MERGE_HEAD .git/MERGE_HEAD_STUCK

Your problem should be half solved already, in some case you need to make a pull from the organizer:

  1. Open the Organizer - Repositories "File > source control > repositories…"
  2. Find the repository of your project and make a pull from here.

Then you should be able to use Git again from Xcode, you will probably have to resolve some merge conflicts but at least this will be under Xcode and not on the terminal.

Note: Consider removing the .DS_Stores from your git repository

like image 104
Flavien Volken Avatar answered Sep 28 '22 09:09

Flavien Volken