There is a way to perform merging with git but committing (upstream) with Subversion that is complicated to set up, but is powerful (and much easier than merging with Subversion!) in practice. First, read Derick Bailey's git+svn overview, because you will need to set up the git and SVN ignore files as he instructs.
Note that this doesn't use the standard git-svn package, but replicates a lot of what that does, manually. If you're already using git-svn, don't use this method. Also, it's only worth using this method if you'll be repeatedly merging from the branch to the trunk (and especially if cherry-picking from the trunk to the branch) because that takes advantage of git's history when performing additional merges.
Then, the basic steps are as follows:
- SVN Checkout
/trunk/
to a working copy folder; I'll assume it's C:\trunk
.
git init
a git repository in that folder; set up .gitignore
; git add -A
; git commit
(see git+svn above).
- Create a git clone of the repository (in a different folder):
git clone C:\trunk foo
. I'll assume this clone is in C:\foo
.
- Delete everything in
C:\foo
except the .git
subfolder, then SVN Checkout /branches/foo
in C:\foo
.
- In C:\foo, run
git add -A; git commit
to save the changes on the branch to the git repository. This creates the initial git history that diverges from the history in C:\trunk.
We now have two folders that are both git repositories and Subversion working copies; additionally, git thinks the folders are clones of the same repository.
Perform work in the C:\trunk
and C:\foo
folders (or just svn update
to get others' work). Periodically, run git add -A; git commit
to save changes to your git repositories.
Now you want to merge the foo branch back into trunk. In C:\trunk, run git pull C:\foo
. This pulls in and merges all the changes from the C:\foo
folder, which is your git repository tracking the /branches/foo
Subversion branch. If necessary, resolve any conflicts and finish the git commit.
You can now commit the changes in C:\trunk to Subversion without having to use Subversion to perform the merge.