Search code examples
gitgit-svn

Delete a svn-Branch via git?


I'am using git as scm of choice but have to use a svn-repo. I can create a svn-remote-branch like this:

git svn branch the_branch

But how can i delete the remote branch?


Solution

  • Currently, it is not possible to delete an SVN branch using git-svn. But it is easy to delete the branch using SVN, without even having to check it out. So simply type

    svn rm $URL/branches/the_branch
    

    Please note that deleting a Subversion branch does not cause it to be deleted from the git-svn repository. (This is intentional, because deleting a Subversion branch does not cause any information loss, whereas deleting a git branch causes its existence to be forgotten following the next git garbage collection.) So if you want the remote SVN branch to be deleted from your git repository, you have to do it manually:

    git branch -D -r the_branch
    rm -rf .git/svn/the_branch
    
    OR
    rm -rf .git/svn/refs/remotes/f8745/ (for newer versions)
    

    To delete a git branch that corresponds to a Subversion tag, the commands are slightly different:

    git branch -D -r tags/the_tag
    rm -rf .git/svn/tags/the_tag