We have an SVN setup with stable trunk and unstable development branch. Dev work is (mostly) done on the branch and then merged to trunk before deployment.
I use git-svn as my SVN client. My merge process from unstable to trunk is as follows:
git svn fetch
git co -b trunk svn/trunk
git merge --no-ff svn/unstable
git svn dcommit
svn/*
are the remote SVN branches.
This of course requires that no one commits anything to the trunk before I am done, but this is not a problem in practice.
The benefits of this process is that git now records the parents of the merge commit in my local repository. This does not benefit my coworkers, but it does allow git to compute the common ancestor when I do the merge. This is very desirable.
And here is the rub. When someone else makes a merge, git doesn't know about it. Here is an example:
o-...-A---o---C--- unstable
/
X--...--B---o---o--- stable
The unstable branch was created at point X. At point A we decide to merge changes from the unstable branch into the stable branch at point B. The common ancestor is correctly X.
Because the merge is not recorded in the git history, the following merge at C again assumes X is the common ancestor. I would like it be A, as in the following graph:
o-...-A---o---C--- unstable
/ \
X---...---B---o---o--- stable
It is not absolutely necessary to get a graph that looks exacly like the one pictured. Any graph, which would recognize A as the common ancestor is fine by me.
I have some options in mind, such as a proper use of git-filter-branch or a "fake" commit which is never dcommited to SVN. However none of my attempts have worked sufficiently so far.
I am grateful for any ideas you can present. The procedure does not have to be automatic. The merges are pretty rare and I can live with the pain of doing it "by hand".