Daniel YC Lin
Daniel YC Lin

Reputation: 15992

Update my git branch followed by svn repository changes in git-svn

I'm using 'git svn' to clone source from svn repository. And use a branch to create new features. The git log graph like

S1-S2+S3-S4-S5-S6-S7 (master)
     +B1-B2-...-B9   (new-feature)

The newest svn version is 'S7' and the latest local branch is 'B9'. I want the graph be rebased like

S1-S2+S3-S4-S5-S6-S7+     (master)
                    +B2-B9 (new-feature)

My operation commands:

git checkout master
git svn rebase     # it updated master to S7
git checkout new-feature
git rebase master  

It will occurs many blank space conflicts, as I know that's because B1,B3...B8 have already checked in svn by other people. Is there smarter method to let me just keep some my patches which is not just space conflict? Here the B2,B9 are just examples. In fact, I don't know which patches should be replaced or merged or skipped in advanced. I just know, some of the svn check in are duplicate with some of Bx patches.

Upvotes: 0

Views: 36

Answers (1)

Vampire
Vampire

Reputation: 38629

You should be able to simply do git svn rebase on your new-feature branch, no need to change to master iirc.

Regarding discarding the B2-B9 commits, you could e. g. do git checkout -B new-feature B1 && git cherry-pick B9. This will recreate the new-feature branch from B1 and cherry-pick the B9 commit. Or you do an interactive rebase like git rebase -i B1, then remove the lines for B2-B8 in the todo list and leave the editor. Or you can do a non-interactive rebase like git rebase --onto B1 B8 new-feature.

Upvotes: 1

Related Questions