Bass
Bass

Reputation: 5338

cherry-picking an individual commit using git-svn

Let's assume I have cloned an existing SVN repository using git svn clone and want to push the changes I make to the new ("forked") upstream Git repository.

At the same time, I want to be able to "pull" any changes from the upstream SVN repository and push them to the upstream Git (the repositories may diverge, but conflicts are unlikely).

  1. How do I do that w/o creating a patch file for every SVN commit (with svn diff) and applying it to the Git repository?
  2. Is it possible to merge a range of commits from SVN (w/o cherry-picking them one by one) and rebase the resulting branch on top of my Git master in a single step?

Upvotes: 0

Views: 693

Answers (1)

Marina Liu
Marina Liu

Reputation: 38136

For your questions:

1.If it’s ok to apply all the commits which is not exist in the local git repo, you can use git svn rebase. If you’d like to apply these commits one by one, you can use git svn fetch and then git cherry-pick commit.

2.Two steps can meet your requirement:

git svn fetch
git rebase --onto master <start commit> <end commit>

It will rebase the range from start commit (not contain it) to end commit (contain it) on master branch.

Upvotes: 2

Related Questions