How to disassociate working copy of an Xcode 5 pro

2020-06-03 03:22发布

问题:

I have a modified working copy of an Xcode 5 project that was checked out from a remote svn server that is no longer available. How can I remove the working copy's svn association and have it not be under source control? (Eventually I want to create a git repository based on the working copy and push modifications to it.) I don't need to retain the svn history.

I've tried the obvious things to disassociate the svn server from the project (such as deleting the .svn directories in the working copy as well as doing a grep -r search on the svn server's name through all the files in the working copy directory tree), but the project remains associated with the svn server. I'd prefer to do this switch directly with the working copy, rather than risking trying to create an empty "working copy" that is not associated with the svn server and then transferring files one-by-one from the current copy. Tools like svn-git aren't feasible as both the svn server isn't available and my working copy contains significant modifications. Help...?

回答1:

I was facing a similar problem just now, I have moved my git from github to gitLabs. However that means the previous repo information is still in my project.

So what I discovered was when I have added my gitLab repo into Xcode, SourceTree showed that one file was modified. Surprise, this is the file that keep records of all your Working Copies servers.

Just navigate to "Your Project".xcodeproj > (Right Click & Show Package Contents) > project.xcworkspace > (Right Click & Show Package Contents) > xcSharedData > "Your Project".xccheckout

Right Click on the file and select Open with, and click on "More..". Use your preferred Text Editor to edit the XML inside, or you can always use the trusty TextEdit.

Your old git/svn servers are probably at the bottom, encased in <dict></dict>. Just remove em and reload your project in Xcode.



回答2:

I managed to find a way, although probably not the easiest or recommended procedure. Here's what got me to my eventual goal of having the working copy pushed to a remote git server:

  1. Remove all SVN information from the working copy by deleting .svn file, etc. (I'd done this before asking my original question.)
  2. Create an empty repository for the project on the remote git server
  3. Add the remote git server in Xcode's Accounts
  4. Close all projects in Xcode and then unselect Enable Source Control in the Xcode Preferences; quit Xcode
  5. Rename the working copy to a temporary name
  6. Launch Xcode, select Enable Source Control, and then checkout the empty repository from the remote git server into a directory with the original working copy name; again disable source control, quit Xcode
  7. Move the .git directory from the checked out (empty) working copy into the original working copy directory (which was renamed in step 5); delete the empty working copy and rename the original working copy back to its original name
  8. Launch Xcode and open the working copy project; the SVN association should be gone
  9. Reenable source control, and the working copy should now be associated with the remote git repository, but with no files added
  10. Open the Utilities inspector and note the tiny Add button in the Source Control area of the Identity and Type pane; click Add to have all the files marked as Added
  11. Commit and push as usual

Voila! My working copy is now under git with a remote git server association. Of course, the SVN history has been lost, but that was not a concern for me. There has to be a shorter recipe, but I wanted to share the above in case it saves anyone in s similar predicament.



回答3:

Remove all unrequited repo from following location

DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey

Checkout all steps Steps



标签: xcode git svn