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.
Because branches and tags are ordinary directories, the svn move command can move or rename them however you wish.
Rename a Remote Git Branch There isn't a way to directly rename a Git branch in a remote repository. You will need to delete the old branch name, then push a branch with the correct name to the remote repository. The output confirms that the branch was deleted.
The git branch command lets you rename a branch. To rename a branch, run git branch -m <old> <new>. “old” is the name of the branch you want to rename and “new” is the new name for the branch.
To summarize the other answers: No, there is no way to rename. You can copy and delete, to achieve a similar effect. But if there is, say, a pull request in progress, you can't avoid losing the comments and approvals. this seems to me to be an annoying missing feature of bitbucket!
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
..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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With