How do I commit current changes in a new branch using TortoiseSVN and Subversion?
Asked Answered
C

2

13

I'm in a situation where I don't want to commit my current changes to the trunk.

I would like to commit to a private branch and work there a little until I'm sure that everything is OK. I will merge changes made in my branch to the trunk.

What is the recommended procedure when you use Subversion and TortoiseSVN?

I have the classic directory structure:

  • /trunk
  • /branches
  • /tags
Caz answered 20/7, 2010 at 14:1 Comment(0)
M
18

This is an option in TortoiseSVN. Click on Branch/tag... from the context menu, then choose "Working copy" from the radio buttons labeled "create copy in the repository from:" and the new branch will come from your working copy.

In the To path textbox, add in the path with the correct "/branches/" path to make sure it conforms to the structure you mentioned (branches/tags/trunk). Don't forget to give your branch a good meaningful name, and I find it useful in the comments to put in the revision number of the trunk which I'm branching from.

Alternatively, create the branch from the trunk separately, then switch your working copy to the new branch, preserving your working copy, and commit to the branch from there.

Muncy answered 20/7, 2010 at 14:4 Comment(4)
Thanks Andrew. Could you suggest me a folder convention there ? All our versions are stored in the /branches, like this: /branches/1.0, /branches/1.1, etc. Would you suggest /branches/user/mydirtywork or something like that?Caz
Yeah, if you're happy and that's clear to your co-workers. You could name it after the project or piece of functionality if that would be even clearer. I've seen people name branches after themselves, but the risk is you end up with lots of them, like "Bobs_branch_2" and "Bobs_other_branch_2008" etc, which is a bit messy and tricky for the next person to grok.Muncy
Sorry didn't notice your extra folder "/user/" there, that would keep it cleaner. Be a little carefult with deep trees in SVN branches and tags though, as it's easy to people to checkout at the wrong level which either takes ages or can make a mess of a working copy.Muncy
If you are working on a ticket, incorporate the ticket number into the branch name.Parashah
P
0

There is now an experimental client-only option to "Shelve" changes available from the context menu. This gathers the changes up on the client under a name you give them. Since these changes will not be stored in the repository, they will not be visible to others. You can later "Unshelve" them to get your changes back. See the documentation page for more details.

The main caveat is that Shelving is experimental. Upgrading your SVN client may invalidate existing shelved change sets should the format change.

Parashah answered 15/7, 2021 at 15:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.