问题
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? :)
回答1:
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)
回答2:
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.
回答3:
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:
回答4:
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.
The solution was restarting Xcode. Everything magically worked afterwards, and i was able to commit the project, including the problematic file.
回答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:
][1
The above assumes you are using Base Internationalization:
For a great reference, take a quick look at iOS Localization Tutorial.
回答6:
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.
回答7:
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.
来源:https://stackoverflow.com/questions/32619751/error-the-source-control-operation-failed-because-the-revisions