Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete a svn-Branch via git?

Tags:

git

git-svn

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?

like image 302
DerKlops Avatar asked Dec 03 '09 12:12

DerKlops


People also ask

How do I delete a branch in SVN repository?

Find the branch folder you want to delete, right-click it, and select "Delete."

How do I delete a branch directly in git?

Deleting a branch LOCALLY Delete a branch with git branch -d <branch> . The -d option will delete the branch only if it has already been pushed and merged with the remote branch. Use -D instead if you want to force the branch to be deleted, even if it hasn't been pushed or merged yet. The branch is now deleted locally.

How do I delete an existing branch?

The command to delete a local git branch can take one of two forms: git branch –delete old-branch. git branch -d old-branch.

How do I remove a branch from a remote repository?

To delete a remote branch, you can't use the git branch command. Instead, use the git push command with --delete flag, followed by the name of the branch you want to delete. You also need to specify the remote name ( origin in this case) after git push .


1 Answers

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 
like image 176
mhagger Avatar answered Sep 19 '22 17:09

mhagger