3

I have a project that usually works with Xcode 4, however since upgrading to Lion and Xcode 4.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
Enrico Susatyo
  • 19,372
  • 18
  • 95
  • 156
  • Tried to push it to an external Git repository, then create a new one within XCode, after that pulling the contents back from the external repo? – vstrien Aug 04 '11 at 12:13
  • You said you tried committing from the terminal but left out a critical detail: did it *work*? – Joshua Nozzi Aug 05 '11 at 13:56
  • git init work, but commit doesn't. from xcode or even gitbox it doesn't work. I tried reinstalling git as well, to no avail :( – Enrico Susatyo Aug 05 '11 at 13:59

5 Answers5

8

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 :)

Enrico Susatyo
  • 19,372
  • 18
  • 95
  • 156
2

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).

Dale Thatcher
  • 83
  • 1
  • 5
  • It might've been fixed in the current version of Xcode. My Commit menu item was grayed out in the version of Xcode I was working with. – Enrico Susatyo Dec 11 '12 at 06:49
0

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.

Tim
  • 1,108
  • 13
  • 25
0

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.

Raptor
  • 53,206
  • 45
  • 230
  • 366
0

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.

Dave
  • 12,408
  • 12
  • 64
  • 67