Git is the default source control method for Xcode and probably the most commonly used control system version for an Apple developer. Recently, many hybrid-develop App developments are required by the market so that other IDEs such as Eclipse have to be used for hybrid developing. In that case, projects would be using SVN (Apache Subversion) as the source control system in Eclipse. As one of the sufferers, I’ve found it is hard to get a good SVN tool with OS X, like TortoiseSVN for Windows. Additionally, managing multiple projects in two or more source control clients drives me crazy and makes the daily work more complex than it already is.
Converting the entire project from SVN to Git is obviously not a choice since some of the teammates would probably use Windows to develop hybrid Apps. Using Git under Windows would be troublesome just like using SVN under OS X.
Here is a way to avoid this kind of pain: using Git to control a project under OS X while keeping the project controlled in an SVN repository. Below are the steps to embed this method:
- Install SVN in the OS X
This step can be mostly avoided if you are an Apple developer, since Git and SVN have been default installed by Xcode. But if you are a project manager or you have a brand new Mac, you’ll have to install the Xcode first. If you don’t want to install the full Xcode package, see How to Install Command Line Tools in OS X Mavericks & Yosemite (Without Xcode). It is much quicker and the tool includes the SVN package as well.
- Link up the SVN correctly
Simply run the two commands separately in Terminal. Commands may need your ROOT permission. (The Commands work well under Xcode 7.3.1)
sudo ln -s /Applications/Xcode.app/Contents/Developer/Library/Perl/5.18/darwin-thread-multi-2level/SVN /System/Library/Perl/Extras/5.18/SVN
Choosing a Global Software Development Partner to Accelerate Your Digital Strategy
To be successful and outpace the competition, you need a software development partner that excels in exactly the type of digital projects you are now faced with accelerating, and in the most cost effective and optimized way possible.
sudo ln -s /Applications/Xcode.app/Contents/Developer/Library/Perl/5.18/darwin-thread-multi-2level/auto/SVN/ /System/Library/Perl/Extras/5.18/auto/SVN
Note: Those two commands can be ignored if you are using an old version of OS X ( OS X 10.10)
- Get an SVN project
Now you can get a SVN project by using Git commands. Simple use:
git svn clone PROJECT_REPOSITORY_URL
And fetch commits using:
git svn fetch
Additionally, more commands can be found HERE
- Find a good tool to control all your Git and SVN projects
I use SourceTree as for the source control tool. If you choose SourceTree, please make sure to download the newest version from their official website rather than downloading it from App Store. The App Store version has been retired for a long time.
Tips: Stash is a lovely function in SourceTree if you want to keep both local and remote changes for a project.