There is an open source project I want to checkout and contribute to. The main repository is SVN but I want to work in Git. Is this possible?
Most of my searches turns u
Yes! This is possible!
Check this post for the details: http://www.romanenco.com/gitsvn
There are three or four simple steps to make symbiosis of SVN and Git SCMs.
I worked with this technology about three month and have no any troubles. It's very cool! When your main repo in the SVN and you can make offline commits and get powerful of Git merging.
Keeping a Git repository in sync with a Subversion repository is really easy:
Clone the Subversion repository (in this simple example I am ignoring branches/tags)
$ git svn clone https://url/to/repo/trunk
Keep up-to-date with the Subversion trunk:
$ git svn rebase
Now, if you had commit access to the Subversion repo, you could push your changes:
$ git commit
$ git svn dcommit
Otherwise, submitting a patch is your only option, if the committers to the Subversion repository have no interest in using Git:
$ git diff 1cc92b96 > my_patch.patch
In this case it's obviously best not to make commits to the branch you are syncing with the Subversion repo.
Luckily there's git-svn for exactly this purpose. It enables you to use git locally while also being able to check in to SVN when you wish to do so. It's fairly straightforward and there are lots of information if you search for git-svn
here or via Google.
There's a tutorial at http://flavio.castelli.name/howto_use_git_with_svn that you might want to look at first.
Edit: To generate SVN compatible diffs you can use git diff --no-prefix
. Note however that this format is not compatible with TortoiseSVN. If compatibility is needed you would have to use some sort of shell script; see example here: http://mojodna.net/2009/02/24/my-work-git-workflow.html
Edit: One potential downside of git-svn is that it does not handle svn externals. You would have to handle those yourself.
Good luck!
If don't have, nor do you want to have, commit access to the SVN repository then a combination of git-svn
and StGit might help. git-svn
creates/updates a clone and stg
maintains a series of patches on top of it (stg
commands is from StGit Crash Course):
git svn clone ..
stg new invent-some-patch-id
...edit patch description...
...hack hack hack in the tree...
stg refresh
...possibly hack some more...
stg refresh
..
stg mail
See StGIT Tutorial to get started.
NOTE: I haven't actually tried this workflow.