git-svn rename tracking branch

前端 未结 1 1178
伪装坚强ぢ
伪装坚强ぢ 2021-01-31 18:42

My current svn cloned branches (using the -s \'standard layout\') option are called:

$ git branch -r
branch1
branch2

I would like to rename tho

相关标签:
1条回答
  • 2021-01-31 19:26

    Assuming that you do not have another remote that was added with git remote add ..., try this procedure:

    1. git gc to package all refs into .git/packed-refs.
    2. Open .git/packed-refs for editing. Replace "refs/remotes/" with "refs/remotes/svn/".
    3. Open .git/config for editing. You should see something like:

      [svn-remote "svn"]
          url = SVN_REPO_URL
          fetch = trunk:refs/remotes/trunk
          branches = branches/*:refs/remotes/*
          tags = tags/*:refs/remotes/tags/*
      

      Replace "refs/remotes/" with "refs/remotes/svn/":

      [svn-remote "svn"]
          url = SVN_REPO_URL
          fetch = trunk:refs/remotes/svn/trunk
          branches = branches/*:refs/remotes/svn/*
          tags = tags/*:refs/remotes/svn/tags/*
      

      Be sure to also update any remote-tracking branches. To do this, you can just replace "refs/remotes/" with "refs/remotes/svn/" in the entire file.

    I tested this procedure with a copy of my git-svn mirror of the GNU Nano repository and it seems to work.

    EDIT: I have just verified that this procedure does not mess up the git-svn dcommit or rebase operations. It is as if --prefix=svn/ were originally specified in the git svn clone -s SVN_REPO_URL command.

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