Question

I'm in a position where I'm the only one using git, everybody else is using svn. I've used 'git svn' to connect to the team svn and mostly it works just fine. Lately, I've started a project initially on my own, separate git repo and now I need to merge stuff from it to the svn. However, I still would like to keep tweaking the implementation in my own privacy between releases.

So, what would be the most straightforward way to cherry-pick some commits from my private repo to the svn-cloned repo? Requirement is to keep full local history and have only one svn commit for each pick. Or is there some squashing to be done?

As a method to achieve this, is there a way to get the private repo as another origin for the svn-cloned repo?

Was it helpful?

Solution

You could try to git graft the commit from your Git repo to the commit of the git-svn repo before git dcommit the git svn repo.

The commit from your repo could be isolated in a special branch, when all kind of squashing can take place in order to export a cleaner history.

OTHER TIPS

If you're the only person using the git repo at the moment, you could consider rebasing all your work on top of the empty subversion clone you've created. Then set up a branch to hold your pushes back to subversion, squash each release onto it and commit it back to SVN.

For a more in-depth solution, consider using git commit-tree directly -- provide it with the tree you want to commit (found by running git show --format=raw HEAD and looking at the second line ("tree")), the correct parent commit (whatever's currently in subversion) and the right log message on stdin. This is using the plumbing directly, you probably want to write a script to do it for you... The effect is that you've created a new commit containing the file contents of an existing commit (compare with cherry-pick, which takes the diff added by an existing commit, rather than copying the tree).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top