Using git-svn: Pull, Merge or Rebase?

后端 未结 2 758
暗喜
暗喜 2021-01-31 18:45

I\'ve been fighting the git/git-svn learning curve and last night, as part of that learning curve, I did something very, very bad. I\'ve since gotten it corrected, but I\'m hopi

相关标签:
2条回答
  • 2021-01-31 19:18

    You should use git svn clone -s to clone complete svn tree, including all branches. From then on use git svn rebase and git svn dcommit in master to deal with svn, and you can create regular git branches for your private use.

    0 讨论(0)
  • 2021-01-31 19:19

    The problem you ran into is that the command line syntax for rebase doesn't match your (very reasonable, IMO) expectations.

    $ git checkout feature1
    $ git rebase trunk
    

    This sequence adds the unshared feature1 commits onto the HEAD of trunk, and you were expecting that it would place the new trunk commits onto the HEAD of feature1. The syntax actually makes some sense when you know how Git's data model is implemented (which is undoubtedly why it is the way it is). But to me it is the opposite of what I expect, functionally. It's best to learn it as an arbitrary construct and not try to have expectations.

    You're right that you understand how to interact with the SVN repo using git-svn. So ignore what you found in Googling about push and pull and merge -- there's a lot of nearly right discussion by people who act as if push and pull and merge are the same in git and svn. Nearly right is still wrong.

    0 讨论(0)
提交回复
热议问题