How to prefix existing svn remotes?
Hi all,
I created a few months ago a git-svn repository using:
git svn clone -s https://my_svn_repo .
wich also created the following remotes:
git branch -r
branch0
tags/tag0
trunk
I would like to prefix theses remotes, so that it shows:
git branch -r
prefix/branch0
prefix/tags/tag0
prefix/trunk
Of course I should have used the -prefix back when creating the repo but it's too late. 'git help svn' doesn't explain how to achieve that and simply editing .git/config to add the missing prefix will cause the next 'git svn fetch' to download again the whole history (which in my case is huge).
Is it possible? Did I miss something obvious?
Cheers,
Signature · 1 line
Sébastien Mazy
Sébastien Mazy venit, vidit, dixit 22.01.2009 18:32:
Quoted 18 lines
Hi all,
I created a few months ago a git-svn repository using:
git svn clone -s https://my_svn_repo .wich also created the following remotes:
git branch -r
branch0
tags/tag0
trunkI would like to prefix theses remotes, so that it shows:
git branch -r
prefix/branch0
prefix/tags/tag0
prefix/trunk
Quoted 8 lines
Of course I should have used the -prefix back when creating the repo but it's too late. 'git help svn' doesn't explain how to achieve that and simply editing .git/config to add the missing prefix will cause the next 'git svn fetch' to download again the whole history (which in my case is huge).
Is it possible? Did I miss something obvious?
Yes! Depends!
The following works for me:
0) fetch to make sure you're current (optional)
1) edit .git/config and add the prefix (right hand side of the refpsecs), or really rename in any way you want
2) rename the existing remote branches in the same way
The next git svn fetch will rebuild the map file (which is fast) but not refetch any svn revisions you already have.
Regarding the renaming: Either I'm dumb or current git branch can't rename git svn branches. I guess it's because they are remotes but not really. I had to resort to git update-ref. I'll look into that.
Michael
Hi Michael,
Thanks for your reply.
Quoted 5 lines · Michael J Gruber
The following works for me:
0) fetch to make sure you're current (optional)
1) edit .git/config and add the prefix (right hand side of the refpsecs), or really rename in any way you want
OK.
Quoted 1 line
2) rename the existing remote branches in the same way
I'm not sure how I can do it. 'trunk' is the only remote-tracking svn branches under .git/refs/. Here is how it looks:
ls -R .git/refs
.git/refs: heads remotes tags
.git/refs/heads: master
.git/refs/remotes: trunk
Still, a 'branch0' remote exist:
git show-ref
refs/heads/master
refs/remotes/branch0
refs/remotes/trunk
Signature · 1 line
Sébastien Mazy
Sébastien Mazy venit, vidit, dixit 23.01.2009 13:42:
Quoted 23 lines
Hi Michael,
Thanks for your reply.
Quoted 5 lines · Michael J Gruber
The following works for me:
0) fetch to make sure you're current (optional)
1) edit .git/config and add the prefix (right hand side of the refpsecs), or really rename in any way you wantOK.
Quoted 1 line
2) rename the existing remote branches in the same way
I'm not sure how I can do it. 'trunk' is the only remote-tracking svn branches under .git/refs/. Here is how it looks:
ls -R .git/refs
.git/refs: heads remotes tags
.git/refs/heads: master
.git/refs/remotes: trunk
Quoted 6 lines
Still, a 'branch0' remote exist:
git show-ref
refs/heads/master
refs/remotes/branch0
refs/remotes/trunk
You can do (bash)
for b in trunk branch0
do
git update-ref refs/remotes/yournewprefix/$b refs/remotes/$b git update-ref -d refs/remotes/$b
done
OTOH, any incarnation of "git -m" (with or without "-r", specifying refs/remotes/trunk, remotes/trunk or trunk) failed.
Michael
Quoted 7 lines · Michael J Gruber
You can do (bash)
for b in trunk branch0
do
git update-ref refs/remotes/yournewprefix/$b refs/remotes/$b git update-ref -d refs/remotes/$b
done
That did the trick. Thank you so much!
By the way, my renamed remote tracking svn branches now show under .git/refs/ as expected.
Signature · 1 line
Sébastien Mazy
Quoted 2 lines · Sébastien Mazy
By the way, my renamed remote tracking svn branches now show under .git/refs/ as expected.
They were inside file .git/packed-refs
Signature · 3 lines
Jakub Narebski Warsaw, Poland ShadeHawk on #git