xcode change from svn to git - iphone

I am working on an iPhone app improvement project. Original project was done using SVN, however, I want to use git for new changes. When I open xcode4 and see source control, I dont see an option to change the source control settings. How can I change the settings so that I can use a local git repository?

You might need to convert that svn repo to a git repo first, with git-svn for instance.
I would recommend using a script like svn2git for this kind of operation (that is, if you don't have to commit back to the original SVN repo. If you do, git-svn is preferable).

Related

How do I work on a branch in SVN Eclipse?

I've read multiple documentations already but I don't seem to get it - I want to branch one project folder of our rcp, change something there and test with the changes I've made there.
Which steps do I have to make to work on the branch? How do I integrate the branch in my workspace for testing without ruining my local files and what does Switch... do?
Working on a branch directly through Subclipse isn't possible. You have to check out to your local machine first and then commit back.
This will override local changes, so make sure to branch them first.
IF you want to test your quick changes in your project without your local changes ,this is what you can do
-Create a new branch of the trunk/active of your project in SVN
-Checkout the new branch from SVN as its own project
make your quick change . Test it locally
Check it back into the branch. When you are ready, merge your code.

Git in Eclipse: How can I overwrite the changes on the repo?

I am very new with git and repositorys and I have a problem. Me and my collegue were working on the same file.
He commited and pushed his changes.
I commited my changes
I pulled
Now I have conflicts and I want to solve them. How can I overwrite the conflicts so that my changes are on the file? I am working with Eclipse.
There is no easy way to resolve conflicts. But tools are available to make the process a little easier. Anyhow you will have to decide and manually make the changes so that both of your changes are available in the latest file.
Try: git mergetool
If you both edited separate parts of the file then the tool will automatically merge whereas if you both have edited the same part then some manual interaction is needed.
If you want Your changes you can use:
git fetch -p
git merge --ours
This will merge the remote with your local branches and in case of any conflict - use your version of code.

Is there a better way to keep your own copy of a customized open source project?

I use an open source project to host a site (OrchardCMS) which is available in a GIT repository via CodePlex. I have made a few customizations to the source code that are specific to my implementation and I want to keep preserved and under source control. However the challenge arises when there's a new release of the source engine.
My changes certainly won't go into the blessed repository everyone uses.
Currently I'm using two repositories. I use the CodePlex OrchardCMS repository to get the latest changes from the engine the community uses (and that I contribute some bug fixes to).
I then have my own copy which contains my changes. For this, I am using my own source control (hosted TFS from Microsoft). When an update to the core engine comes out, I XCOPY all the files from the current source to my self-maintained repository and commit them to my project.
However this seems like there should be a better option. Any opinions?
You can use git to have an alternative solution.
You can clone the git main repo and keep it updated with the new relases, and you can keep your local modifications, that aren't to be shared with anyone, on a local branch.
When a new release came out, you simply update your master branch in your git repo an then you can rebase or merge your local modications on top of it.

Git, SVN and Eclipse workflow

I am trying to adopt the following workflow:
git svn clone a svn repository through command line (egit doesn't support git-svn)
Open the project in eclipse with egit since I rather use egit to branch, merge, commit etc...
When i'm ready commit the changes back, I use use git svn dcommit to commit back to svn
I am having trouble with step number 2, don't understand how to import a git project, eclipse tells me i can't import it to use the same directory it's currently in because another project with the same name is already there. this is confusing.
Anyone knows how to do this ?
Also would like to hear other workflow examples that uses egit and git svn. I am aware that it is better to do it all through command line, however, I am trying to ease the move to git for fellow developers in my team, who are not used to command line interface etc...
I've worked briefly with the egit plugin (I actually recently stopped using it and just use msysgit as my Git guiclient and run it separately from Eclipse). I find Eclipse very busy as is and adding this plugin slows it down (for me at least).
What I did when setting up an already cloned project in Eclipse:
In Eclipse. File -> Import -> Existing Project into Workspace
Select root directory of project. Do NOT check copy projects into workspace. Click finish.
After project has been imported. Right click on project, go to Team -> Share Project
Select Git as a repo type, click next
Check use or create repo in parent folder of project. Since you already cloned the project it will be tracked with git. When you check this option it will show the project, the path, and the repo (.git).
Click finish and you will be all set.
I think you'd better use SubGit instead of git-svn.
SubGit works on a server side. It synchronizes all the modification between Subversion and Git repositories automatically on every incoming modification from either side.
From the client perspective SubGit enabled repository is a usual Git repository, so you may pull from and push to it. Please refer to SubGit documentation or SubGit vs. git-svn comparison for more details.

Version control on an external project

I am working on an enormous project ("the project") which is open-source, and I am changing the project but don't have a permission to commit. I'm looking for strategies for maintaining my own branch of the project. Some issues I am contemplating:
How to put my own work in a version control system, given that I'm altering the project's source code, adding new files and so on.
How to keep in sync with the project without having to manually merge my own changes over and over again.
I've never been in this situation - I've always maintained my complete project in some version control system. My plan right now is something like that:
Creating a directory tree in my SVN, similar to the one in the project.
Keeping all the changed files (and only them) in my svn.
Every time I decide to sync with the new baseline of the project, I'll do a checkout, merge my svn tree into the new version, test, then commit my changes to my svn and distribute them along with the latest project baseline.
The problems here are ENDLESS. Way too many manual steps, more and more work over time, and so on. The correct way to go would be, of course, to be a part of the original project, but this seems to be quite irrelevant right now for various reasons and is out of the question.
Ideas?
I'd use git or mercurial for this; simply import the project into git or mercurial, and merge the upstream changes into a branch in your project for easy merging into your trunk.
If the upstream project has a repository of their own, the import is even easier. Both git and mercurial have support for directly importing other version control systems. I did this recently to adapt an existing project that lives in SVN: https://github.com/mjpieters/rod.recipe.rabbitmq
Note that that project has an 'upstream' branch. That particular project has now accepted my proposed changes after reviewing the changes in github.com.
There are a few questions here on SO on the subject:
Fork and synchronize Google Code Subversion repository into GitHub
Tracking upstream svn changes with git-svn and github?
Best way to fork SVN project with Git
It should be trivial to create a similar setup with mercurial.
You can use git to maintain your source control on your local system. In fact Git can be used to maintain just about any directory under version control. There is no need to sync to anything, git maintains all changes locally.
If you need to commit to SVN check out the documentation http://git-scm.com/docs/git-svn