I have a project that usually works with Xcode 4, however since upgrading to Lion and Xcode 4开发者_StackOverflow.1 it doesn't seem that I can commit my changes anymore. I have git setup in my project folder. I've tried to commit using terminal, but in xcode I only have the "Unable to load revisions" message.
In File -> source control, many things are grayed out as well.
Does anyone know how to fix this?
Just to help, I've tried:
- commiting form terminal
- making sure git installed in /usr/local/git
- clean install
- remove project from organizer and add it back again
I'm not sure what I did, but after restarting my computer it seems to be working again... So if you guys are having some problems try to restart your computer first :)
You might want to try and "Commit" from the source code menu. I just saw this issue and got a sensible error message after selecting it. (XCode was choking on my .gitconfig file).
I have a "hunch" this is caused by Time Machine doing local backups (snapshots). If you shut Time Machine off when you're not connected to your external backup hard-drive (e.g. you're mobile on a laptop), I "think" it stops the issues with git from occuring.
Git does work from CLI. If Xcode gives you the project is not recognized message with various menu-items grayed out, you can still cd into the directory and do git add .
followed by git commit -m "commit message"
and it'll work. Also, git log
reports things correctly. The repository looks fine.
So it basically is a bug with Xcode 4.1 (build 4B110) on Lion. Closing a project and rebooting has fixed it for me "sometimes", but not others. A 2nd or 3rd reboot might be necessary. Or, shut off Time Machine completely when you're not connected to your external HD.
UPDATE: After some more experimentation, this glitch does not appear to be caused by Time Machine. Regardless if it's on, off, or has a queued backup, the glitch still occurs.
This is a blend of all of the above but I just fixed the problem. I almost certainly got myself into the mess by copying my project between several different drives at different times. The repository had the "Unable to load revisions" message in Xcode .
I downloaded the command line Git program (not the GUI, that did not seem to help) from here:git-scm
I ran the installer and restarted the terminal to get the paths working. I followed the instructions for setting up a Git depository from the Xcode documentation, but of course this failed because there was already one there. So I closed the project and Xcode then went to Finder and deleted the .git directory. This is a brutal approach! You will lose knowledge of all previous changes.
You need to run this line from the terminal if you cannot see the hidden directories:
defaults write com.apple.Finder AppleShowAllFiles YES
Then I followed the instructions from the Xcode docs again:
git init
git add .
git commit -m "Initial Commit"
That fixed it. Hope it helps someone else.
As of Xcode 11.2.1 (as well as Xcode 12), I encountered the same problem as well (Git-source-controlled Xcode workspace does not show any changes), and the Source Control > Commit shows nothing. I tried to reboot the computer but does not solve the problem at all.
To solve this problem, I went to the Terminal and navigate to the root folder of the Xcode project. Then issue the following command in the project root directory:
git status
After it refreshes the status of the Git for a while, Xcode starts showing up the changes at Source Control > Commit and the File Hierarchy again. Works like charm.
精彩评论