0

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.

Daniel YC Lin
  • 15,050
  • 18
  • 63
  • 96

1 Answers1

1

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.

Vampire
  • 35,631
  • 4
  • 76
  • 102
  • I've edited my question, the problem is I don't know which patch should I replace or skip in advanced. – Daniel YC Lin Sep 01 '17 at 00:46
  • Well, they are **not** duplicates, otherwise the commit would be empty on rebase and thus automatically skipped. Different whitespace is not a duplicate. So when / how do you want to determine / find out which commits to skip? It sure cannot be done automatically if there are differences. Git is a stupid content tracker. Whitespace can be significant, so Git would have to know about the format of the file to "know" that whitespace difference is not meaningful. And even if it is not meaningfull technically, it could still be meaningful for a human eye. – Vampire Sep 01 '17 at 03:02