28

I've installed Xcode 7, and now always get this message when I select "commit" from xcode menu.

"The source control operation failed because the revisions... could not be found."

Any idea? :)

error message

Franck
  • 8,939
  • 8
  • 39
  • 57

7 Answers7

9

That could happen if the state of the git repo isn't proper:

  • file outside if a git repo, or
  • no commit yet (initial first commit), or
  • no files added to the index

(there was also repo of XCode 7 crashing on git commit)

Go to the parent folder of the modified file, and to a git status, to check what is actually going on.
Check also (just after seeing that error message) the /Applications/Utilities/Console.app in case there are more clues (as it was done before for this other error bug report)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    Thanks for the suggestions, still not ok Nothing on console. The key point are that if I use sourceTree, it work. Look like Xcode cannot see previous version(nothing appear on the left window). Other idea? – Franck Sep 27 '15 at 02:04
  • @Franck What a `git status` done in the repo root folder return? – VonC Sep 27 '15 at 05:13
  • git status On branch master Your branch is up-to-date with 'origin/master'. nothing to commit, working directory clean – Franck Sep 27 '15 at 18:23
8

I had the same situation. In my case, with several files I got the error for any git related operation and other files it worked fine.

Finally I found that those file paths were a little bit wrong on Xcode "File Inspector" view. The file path I saw was like "Foo/foo.m" but actually it must be "foo/foo.m". I clicked the folder icon and select the file again. Then Xcode shows the correct path and I've got working.

I hope this helps someone's situation too.

Colíbri
  • 81
  • 2
  • Incredible! This has fixed this glitch for me also. Some files did have vlexer folder name, while actually name is VLexer. And I did not rename this folder many months. I only did some merges of develop and feature branch. So not clear how this difference come into life. – Ruslan Zasukhin Jun 23 '18 at 16:32
7

If you have Version Editor > Blame turned on, turn it off. You can do this by clicking the button with the lines (highlighted) to show the Standard Editor again. Here's a screen shot:

enter image description here

Aaron
  • 7,055
  • 2
  • 38
  • 53
6

Same thing happend to me. Xcode claimed of failing to find a revision of a file while trying to commit - even though i was able to see its previous versions using the Comparison and Blame views.

enter image description here

The solution was restarting Xcode. Everything magically worked afterwards, and i was able to commit the project, including the problematic file.

chikko
  • 416
  • 5
  • 9
5

It is in the wrong folder!

This is due to your localization .strings file not being in the correct folder.

When you create the localization file for your Base, make sure to put it in Base.lproj folder, like so:

][Add Localizable.strings in correct folder1

The above assumes you are using Base Internationalization:

enter image description here

For a great reference, take a quick look at iOS Localization Tutorial.

Mick
  • 30,759
  • 16
  • 111
  • 130
3

I had the same problem. The problem was the file path stored in XCode. When I looked at the full path in the file inspector it was incorrect. Removing the troublesome files from the project and re-adding them fixed it for me.

Uilleann
  • 506
  • 4
  • 14
0

the reason is that you change the .h/.m file 's path or name, so the source control operation couldn't know the repository.

To solve that problem ,you just remove reference and add file to the project again. There will be an amazing result happening.