Delete a branch in TortoiseSVN

SvnTortoisesvn

Svn Problem Overview


How do I delete a branch in TortoiseSVN?

  1. Can I simply delete the working copy of the branch and the folder in the repository?
  2. Should the local working copy of the branch first be deleted, or the branch folder through the Repository Browser be removed?

Svn Solutions


Solution 1 - Svn

Right click on any folder, select "Repo-browser" and find your branch on the left panel. From there, you can issue a "Delete" command directly on the repository:

https://i.imgur.com/B2na8h4.png" width="300" alt="Repository browser screenshot">

As far as I know, you cannot issue a delete command on the top folder* of the working copy, probably because that would effectively destroy the working copy.

(*) You can of course remove the branch from the working copy if it's an inner folder, i.e., you check out e.g. https://svn.example.com/repo/project/branches instead of https://svn.example.com/repo/project/branches/feature-blah.

Solution 2 - Svn

The SVN book ("Version Control with Subversion") explains how to delete and restore branches.

Although it suggests remote deletion like

$ svn delete http://svn.example.com/repos/calc/branches/my-calc-branch \
  -m "Removing obsolete branch of calc project."

you could also do it locally (with the TortoiseSVN > Delete command).

As mentioned in the book, you can always restore branches, so you won't get any unexpected consequences.

Solution 3 - Svn

> How do I delete a branch in TortoiseSVN?

There's more than one way to do this, but after years of experience with Tortoise I have found deleting via the Repository Browser to be the least troublesome way.

Right click on the working copy and open the Repo-browser:

enter image description here

The browser looks like this:

enter image description here

Right click on the item and choose to delete it. You'll then be asked for a commit summary. Enter your rationale and click OK.

> Can I simply delete the working copy of the branch and the folder in > the repository?

If you have the branch checked out on its own, i.e. just that branch with its own .svn folder then technically there is no need to delete the working copy. The order of operation doesn't matter in this scenario.

> Should the local working copy of the branch first be deleted, or the > branch folder through the repository browser be removed?

If the item you are deleting is checked out as part of a bigger tree - for example, you have the entire /branches folder checked out in one place - I recommend deleting via the Repo-browser and then svn updating the working copy to pick up the deletion.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJohnView Question on Stackoverflow
Solution 1 - SvnÁlvaro GonzálezView Answer on Stackoverflow
Solution 2 - SvnAndiDogView Answer on Stackoverflow
Solution 3 - SvnStephen KennedyView Answer on Stackoverflow