tags:

views:

88

answers:

2

I would like to know if there is a clean way to do git-svn dcommit of multiple local commits as 1 commit into subversion.

The situation that I have is I am cherry picking some bug fixes changes from our trunk into the maintenance branch. The project preference is to have the bug fixes to be committed as 1 commit in subversion, but I would like to keep the history of changes that I had cherry-picked on my local git for references.

Currently what I do is to do all cherry-picking on branch X and then do a squash merge into new branch Y. The dcommit will then be done from branch Y.

Is there a better way to do it without using an intermediary branch?

A: 

You can squash things together with git reset --soft or git rebase -i (if it is not top commits).

Example: git reset --soft HEAD~4 && git commit -m 'Bug fixes' will sqush 4 last commits into one.

Vi
As I have mentioned in the original question, I would like to keep the commits history in the local git. I only want to have 1 commit in the subversion repository. Your answer does not solve my question.
DJ
What picture do you want to get in the end? You should consider that each commit that gets to into SVN gets "git-svn-id" mark in commit message and can have only 1 parent, which is also "git-svn-id". In git-svn's "trunk" you will see the history as it is in SVN. Local commit history will inevitably be in separate branch.
Vi
+1  A: 

You can't do that without using extra branches. The branch you dcommit from will reflect the SVN view of history after you dcommit. If you would like to preserve the original unsquashed git view with multiple commits, you will need to use an extra branch.

(And yes, I wish this wasn't true too)

NUXI