git-svn rename tracking branch
git, git-svn
Solution
Assuming that you do not have another remote that was added with `git remote add ...`, try this procedure:
- `git gc` to package all refs into `.git/packed-refs`.
- Open `.git/packed-refs` for editing. Replace "refs/remotes/" with "refs/remotes/svn/".
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.
Problem
My current svn cloned branches (using the -s 'standard layout') option are called: ``` $ git branch -r branch1 branch2 ``` I would like to rename those, such that they are: ``` $ git branch -r svn/branch1 svn/branch2 ``` As though I had called $ git-svn clone --prefix svn originally. I don't need to change any names on the remote side.