使用git svn创建新的svn分支

使用git svn创建新的svn分支,git,branch,git-svn,Git,Branch,Git Svn,在使用git svn和“典型”svn repo/trunk、/branchs/..、/tags/。。。 如何将本地分支推送到/branchs中的新分支?假设我们有一个骨架Subversion存储库,其中包含空的主干/,分支/,以及标记/: /tmp$ git svn clone -s file:///tmp/svn-repo/ git-svn-repo Initialized empty Git repository in /tmp/git-svn-repo/.git/ r1 = 80bdcfc

在使用git svn和“典型”svn repo/trunk、/branchs/..、/tags/。。。
如何将本地分支推送到/branchs中的新分支?

假设我们有一个骨架Subversion存储库,其中包含空的
主干/
分支/
,以及
标记/

/tmp$ git svn clone -s file:///tmp/svn-repo/ git-svn-repo Initialized empty Git repository in /tmp/git-svn-repo/.git/ r1 = 80bdcfc0cf248b74b914a1b5f99ab89fb4e31b6c (refs/remotes/trunk) Checked out HEAD: file:///tmp/svn-repo/trunk r1 /tmp$ cd git-svn-repo/ /tmp/git-svn-repo$ git svn branch my-branch Copying file:///tmp/svn-repo/trunk at r1 to file:///tmp/svn-repo/branches/my-branch... Found possible branch point: file:///tmp/svn-repo/trunk => file:///tmp/svn-repo/branches/my-branch, 1 Found branch parent: (refs/remotes/my-branch) 80bdcfc0cf248b74b914a1b5f99ab89fb4e31b6c Following parent with do_switch Successfully followed parent r2 = 56150bbd9d3aec94972ff46d030e30ec726595ab (refs/remotes/my-branch) 您还将在git端看到新的分支:

/tmp/git-svn-repo$ git branch -r my-branch trunk /tmp/git svn回购$git分行-r 我的分行 大旅行箱 要提交到新创建的分支,请首先切换到它:

/tmp/git-svn-repo$ git reset --hard remotes/my-branch HEAD is now at 2c9bef2 Create branch my-branch /tmp/git svn repo$git reset——硬遥控器/我的分支 负责人现在在2c9bef2创建分支我的分支 接下来,我们将创建一个伪git提交

/tmp/git-svn-repo$ touch on-my-branch /tmp/git-svn-repo$ git add on-my-branch /tmp/git-svn-repo$ git commit -m 'First commit to my-branch' [master b94a0eb] First commit to my-branch 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 on-my-branch /tmp/git svn回购$touch我的分行 /tmp/git svn回购$git添加到我的分行 /tmp/git svn repo$git commit-m“首次提交到我的分支” [b94a0eb大师]首先向我的分支机构承诺 0个文件已更改,0个插入(+),0个删除(-) 在我的分支上创建模式100644 最后将其发送到Subversion:

/tmp/git-svn-repo$ git svn dcommit Committing to file:///tmp/svn-repo/branches/my-branch ... A on-my-branch Committed r3 A on-my-branch r3 = d3c5ba3e03e5cdee96f470ff4c9898eb7c523ed8 (refs/remotes/my-branch) No changes between current HEAD and refs/remotes/my-branch Resetting to the latest refs/remotes/my-branch /tmp/git svn回购$git svn DCOMIT 承诺file:///tmp/svn-repo/branches/my-branch ... 我的树枝上有一棵树 承诺r3 我的树枝上有一棵树 r3=D3C5BA3E03E5CDEE96F470FF4C98EB7C523ED8(参考/远程/我的分支) 当前HEAD和refs/remotes/my branch之间没有更改 重置为最新的参考/远程/我的分支 Subversion工作副本为我们提供了确认:

/tmp/svn-repo-wc$ svn up A branches/my-branch/on-my-branch Updated to revision 3. /tmp/svn回购wc$svn上涨 A树枝/我的树枝/在我的树枝上 更新至第3版。如上所述,您现在可以切换到svn分支,而无需执行重置--硬操作:
git checkout-b我的本地分支远程分支
编辑
git提交
git svn dcommit
git checkout master#重新在主干上工作
/tmp/svn-repo-wc$ svn up A branches/my-branch/on-my-branch Updated to revision 3.