xcode does not show files in the commit window - xcode

I have checked out a copy of a SVN project, I have modified some files and want to commit the changes. If I go to File > Source Control > Commit. I see an empty list and a button saying "Commit X files". I expected a list of the modified files.
Now, I use the command line tool (svn ...). But I want to bring back the Xcode commit window.
How may I fix it?
BTW. I'm using Xcode 4.6.1

That is a very very strange screen shot. Sometimes Xcode's svn integration can be a bit strange. If I were you I would just cancel out of the strange empty dialog and use svn at the command-line in Terminal instead.

In file > preferences there is a source control section. You probably have the check box checked to update the source control automatically. So, because it is already updating the source control, it doesn't let you do it.
So you can uncheck that box to make it not automatic, then change something in your project and try to commit the changes. You will probably see some files now.

Related

I accidentally closed my Xcode application. How do I undo any changes?

I was testing out some new swift code. I knew that if I made any mistake I could simply revert back to my old code by pressing Command+Z.
But I accidentally closed my Xcode Editor while writing new code.
How would I undo the new changes and go back to my old original code? I did not make use of github for this.
There might be a chance you can view the file's old history. Check out George Marmaridis' answer
Here is what he says:
You might not be out of luck. Although Git can't help you, Finder may be able to come to the rescue!
If you have not turned off the Versions feature (which by default is turned on and you need a Terminal command to disable), then do the following:
Quit Xcode.
Open the file you wish to bring back your lost changes to using TextEdit.
Go to File > Revert To > Browse All Versions...
Scroll through the available versions. Hopefully you will have many available to choose from.
Select a version and hit Restore.
Follow 2-5 for all necessary files.
Launch Xcode. You should now see the M next to these files in Project Navigator indicating they include uncommited changes (the changes you previously discarded).

My Storyboard Wont Open

So I went to sync my changes with Github and I ran into a few problems with main.storybaord. So I re opened Xcode, opened my project, and I saw a C next to my storyboard.
Now when I try to open it, nothing shows up except for an error message saying:
Interface Builder was unable to determine the type of
"Main.storyboard".
Please Help! Thanks!
The C means Merge Conflict.
You basically have two options:
revert to the last working revision
resolve the merge conflict by picking the correct change
The first one will revert all the changes that where made since the last commit. Right click the file, choose "Source Control" / "Discard Changes in ..."
The second one is best done from the terminal. Open the terminal, go to your project root and run
git mergetool
FileMerge will open, pick the correct changes in there.
Then do a
git commit
to commit the merge.

Why aren't my commits showing up in Xcode 4?

I am a new programmer and trying to use Xcode's source control manager to keep track of changes to my code.
Right now I would like to revert back to a previously committed version of my project. However, in opening the Organizer, selecting Repositories, and selecting my project from the left project list, I can only see snapshots of my project.
The previously committed versions appear correctly when using the Version editor outside of Organizer.
Ideas?
I don't believe you can do this within Xcode but it is simple enough outside of Xcode. The easiest approach would be enter the following in Terminal:
git checkout -b <new branch> <commit>
This won't revert on the current branch but will give you a new branch to develop off of. If you really want to revert then simply:
git revert <commit>
with conflict resolution will work.
If you can't find 'git' within the Terminal then 1) install the Xcode command line tools or 2) look in the Xcode package under Xcode/.../usr/bin to find it.

How to make Xcode refresh the editor content?

I am developing a project with Xcode 4.1 using Subversion through Xcode's built-in source control menu and command line. When reverting/updating the source through command line, I can't get the Xcode editor to show the current version of the source files (as they appear in the Finder or any external editor). I guess this is generally the case when editing a source file with an external editor.
Eclipse would immediately warn you that the editor content is outdated (Xcode does it when you try to save the file). Then you would simply right click on the project tree to refresh the corresponding files/directories. There must be a similar feature in Xcode.
svn revert MyFile.m
will copy the old back and therefore also the old timestamp, making XCode think it is using the most recent version of the file (which is true, except that in this particular situation you would want it to use the older version again).
As a workaround you can "touch" all the reverted files, giving them a new timestamp.
touch MyFile.m
That will make XCode display the content as it is in the file and also include it in the next build iteration. This works for .h/.m files but also any project or meta data files used by XCode.
Do you mean Menue:File >> Source Control >> Refresh Status ?

Make Xcode 4 stop auto staging with git

I hate it that whenever I make a change in Xcode 4 it automatically does a "Git add" command. Is there a way to make this stop?
What I do is perform all my git interaction through the command line. Since I can't get Xcode to ignore the fact that my project is under git control, and since therefore I can't get Xcode to stop doing git add for every new file I create, when I get to the command line the first thing I do is git reset to reset the index. This undoes all the annoying git add stuff that Xcode did automatically. Now I'm in charge of what goes into the index and so I get to form my own commits the way I want.
For Xcode 6 this is not an issue anymore. Visit Preferences -> Source Control tab and turn off 'Add and remove files automatically' checkbox
No. Xcode 4's git integration is "broken" in that they tried to present a uniform interface to source control regardless of whether the back-end is git or svn. That means they're supporting only the lowest common denominator of functionality. As a result, use of the index (the "staging area") is out. It always does auto-adds no matter whether you want it to or not.
EDIT: Actually, I don't think it auto-adds. I think it always does commit -a. Looking at git status on the command line shows me many new and modified files that are NOT staged. But I'm sure if I committed with Xcode they'd all end up in that commit.
For me, the solution was this one https://stackoverflow.com/a/6378745/1078859
TL;DR; remove the repository from xcode's organizer
While the question title says XCode 4 this question appears at the top for many search results related to this issue even in newer versions of XCode. Here is an answer that addresses newer versions of XCode. In XCode 6 you can turn off version control by going to XCode --> Preferences --> Source Control Tab and uncheck Enable Source Control.

Resources