Search code examples
gitgit-svn

git-svn dcommiting a single git commit


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 right now I only want to have bar end up in the svn repo. Is this possible?


Solution

  • I have one sort of crusty answer. You can create a new branch with out foo, bar, and baz in it and then cherry-pick bar to the new branch and then git-svn dcommit that branch and remove it when you're done. That doesn't seem very elegant though.

    So assuming foo, bar, and baz are in branch x and master doesn't have any of them.

    git branch y master

    git checkout y

    git cherry-pick <sha1 of bar>

    git svn dcommit

    git checkout x

    git svn rebase

    git branch -d y

    If master does have these commits you can reset the head as Sizzler suggests.