简体   繁体   中英

git: correct way to merge/rebase with respect to svn dcommit

I have the following situation (mostly because I didn't really thought it through in the beginning -- or more exactly, I thought it shouldn't be a problem the way I did this but now I am stumbled):

... --- A --- B1 --- ... --- Bn

... --- git-svn

Whereby A and git-svn are at the same state (exactly the same files and file content) but they don't have any common point in history.

And I want:

... --- git-svn --- B1 --- ... --- Bn

Or at least, when I do the svn dcommit, I want exactly to get the commits B1 to Bn and nothing else.

I am not exactly sure how dcommit works. So if I would get something like this:

... ------------ A --- B1 --- ... --- Bn
                  \                    \
... --- git-svn -- A' ----------------- B'

would the dcommit behave in the way I want? Because if so, that would be easy to get (merging A into git-svn does work just fine because they are content-wise the same).

Or should I do some sort of rebase? But I don't want to rebase A on git-svn , just B1 to Bn .

dcommit does an svn commit for each commit from git-svn to HEAD (or the commit you specify).

I think your last sentence is the way I'd approach it: rebase B1 to Bn onto git-svn . This is done as follows:

git checkout Bn
git rebase --onto git-svn B1 Bn

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM