1

When using Xcode's Source Control, I get the following error after pressing commit # Files and Push.

The working copy “Project” failed to commit files.

fatal: cannot do a partial commit during a merge.

I am using Xcode 9+. I have looked here but have not found anything that resolves the issue for Xcode's Source Control.

Thanks for the help.

rmaddy
  • 314,917
  • 42
  • 532
  • 579

1 Answers1

5

You will have to use your terminal to resolve this. Xcode (as of Xcode 9) does not support many of the features in git e.g git stash.

Option 1 - Stage changes and commit using Xcode

Following this SO answer, try to stage all the local changes and repeat your steps with Xcode

  1. Open up terminal
  2. Navigate to project directory: cd /path/to/project
  3. Stage all local changes: git add .
  4. Open Xcode and try to commit again.

Option 2 - Stage and commit using terminal

If Option 1 did not resolve the issue, you can complete this task with terminal itself

  1. Open up terminal
  2. Navigate to project directory: cd /path/to/project
  3. Stash your changes (IMP): git stash save name-this-stash
  4. Reset code changes: git reset --hard HEAD~30
  5. Pull the latest state of remote: git pull origin branch-name
  6. Re-apply local changes: git stash apply
  7. Check current status: git status
  8. Stage changes to commit: git add file1 file2
  9. Commit changes: git commit -m "commit-message"
  10. Push changes to remote: git push origin branch-name

Hope it helps!

nkshio
  • 1,060
  • 1
  • 14
  • 23