I created a branch of an SVN project called 'features', and now whenever I try to update said project, it brings with it a features folder, which contains another copy of the project from the branch. Is there a way to remove the branch from the repository completely so that this doesn't happen any more?
This question is related to
svn
version-control
branching-and-merging
You can also delete the branch on the remote directly. Having done that, the next update will remove it from your working copy.
svn rm "^/reponame/branches/name_of_branch" -m "cleaning up old branch name_of_branch"
The ^
is short for the URL of the remote, as seen in 'svn info'. The double quotes are necessary on Windows command line, because ^
is a special character.
This command will also work if you have never checked out the branch.
Assuming this branch isn't an external or a symlink, removing the branch should be as simple as:
svn rm branches/< mybranch >
svn ci -m "message"
If you'd like to do this in the repository then update to remove it from your working copy you can do something like:
svn rm http://< myurl >/< myrepo >/branches/< mybranch >
Then run:
svn update
You can delete the features folder just like any other in your checkout then commit the change.
To prevent this in the future I suggest you follow the naming conventions for SVN layout.
Either give each project a trunk, branches, tags folder when they are created.
svn
+ project1
+ trunk
+ src
+ etc...
+ branches
+ features
+ src
+ etc...
+ tags
+ project2
+ trunk
+ branches
+ tags
Command to delete a branch is as follows:
svn delete -m "<your message>" <branch url>
If you wish to not fetch/checkout the entire repo, execute the following command on your terminal:
1) get the absolute path of the directory that will contain your working copy
> pwd
2) Start svn code checkout
> svn checkout <branch url> <absolute path from point 1>
The above steps will get you the files inside the branch folder and not the entire folder.
For those using TortoiseSVN, you can accomplish this by using the Repository Browser (it's labeled "Repo-browser" in the context menu.)
Find the branch folder you want to delete, right-click it, and select "Delete."
Enter your commit message, and you're done.
From the working copy:
svn rm branches/features
svn commit -m "delete stale feature branch"
Source: Stackoverflow.com