Given multiple unpushed git
commits, is it possible to git-svn dcommit
only one of those commits?
e.g. I have commit foo, bar, and baz, but rig
I somtimes only want to commit a few commits of my branch. E.g.
A-----B-----C------D
^ ^
| |
svn/trunk trunk
If I want to commit B
and C
but not D
I create a new branch, do a svn dcommit
, switch back to trunk
and delete the branch.
While I'm on branch trunk
I do
git checkout -b temp `C`
git svn info // just to check that branch temp is properly connected to svn
git svn dcommit
git checkout trunk
git branch -D temp
EDIT
Like Stefan commented:
With an additional 'git svn rebase' it worked well for me.
This is necessary, because the commits that are committed to svn will be rewritten. git-svn
adds the git-svn-id
to the commit message and therefore the commit hash changes even if the commit's contents are the same. But since the contents are the same the rebase will not cause conflicts.
PS: I also often omit the new branch and just checkout detached. E.g.
git checkout --detach C
git svn dcommit
git checkout trunk
git svn rebase