How to properly create an SVN tag from trunk?

svn create tag from trunk
how to create branch in svn using eclipse
svn checkout tag
svn list tags
svn switch to tag
svn create branch from working copy
how to create trunk tags branches in svn
svn copy

I am creating my first project in Subversion. So far I have

 branches
 tags
 trunk

I think I immediately need to make branches singular and start over. Update branches is the norm.

I have been doing work in trunk and moving the contents to tags as follows.

mkdir tags/1.0
cp -rf trunk/* tags/1.0
svn add tags/1.0
svn commit -m " create a first tagged version"

My gut tells me this is totally wrong, and I should maintain some relationship between the files using svn copy. The files I create in this way will have no relationship to each other, and I am sure I will miss out on Subversion features. Am I correct?

Should I use svn copy for the individual files?

mkdir tags/1.0
svn add tags/1.0
svn copy trunk/file1 tags/1.0
svn copy trunk/file2 tags/1.0
svn copy trunk/file3 tags/1.0
svn commit -m " create a first tagged version"

Should I use svn copy on the entire directory?

svn copy cp -rf trunk tags/1.0
svn commit -m " create a first tagged version"

You are correct in that it's not "right" to add files to the tags folder.

You've correctly guessed that copy is the operation to use; it lets Subversion keep track of the history of these files, and also (I assume) store them much more efficiently.

In my experience, it's best to do copies ("snapshots") of entire projects, i.e. all files from the root check-out location. That way the snapshot can stand on its own, as a true representation of the entire project's state at a particular point in time.

This part of "the book" shows how the command is typically used.

Branching and Tagging in SVN, What is the difference between trunk branch and tag in SVN? Steps: Create folder which will be your working copy of the code. Let's say "MyProjectCodeWorkingCopy". Right click on the folder called "MyProjectCodeWorkingCopy" and select "SVN Checkout". Provide "URL of repository" as your repository trunk location.

Use:

svn copy http://svn.example.com/project/trunk \
      http://svn.example.com/project/tags/1.0 -m "Release 1.0"

Shorthand:

cd /path/to/project
svn copy ^/trunk ^/tags/1.0 -m "Release 1.0"

What is trunk, branch and tag in Subversion?, are created as a snapshot of the project at a point in time and then never changed. branches tags trunk I think I immediately need to make branches singular and start over. Update branches is the norm. I have been doing work in trunk and moving the contents to tags as follows. mkdir tags/1.0 cp -rf trunk/* tags/1.0 svn add tags/1.0 svn commit -m " create a first tagged version"

As noted by @victor hugo, the "proper" way is to use svn copy. There is one caveat though. The "tag" created that way will not be a true tag, it will be an exact copy of the specified revision, but it will be a different revision itself. So if your build system makes use of svn revision somehow (e.g. incorporates the number obtained with 'svn info' into the version of the product you build), then you won't be able to build exactly the same product from a tag (the result will have the revision of the tag instead of that of the original code).

It looks like by design there is no way in svn to create a truly proper meta tag.

Tags, Creating a Simple Tag​​ If you want to create a snapshot of /calc/trunk exactly as it looks in the HEAD revision, make a copy of it: $ svn copy http://svn.example.com/repos/calc/trunk \ http://svn.example.com/repos/calc/tags/release-1.0 \ -m "Tagging the 1.0 release of the 'calc' project." Committed revision 902. When we create SVN repo's at work we svnadmin create and then svn import a skeleton folder of the 3 directories and commit that at once pushing it to revision 1 (We have a bash script automate all of this). I don't think there's a better practice than to just have the initial commit?

Just use this:

svn  copy  http://svn.example.com/project/trunk  
           http://svn.example.com/project/branches/release-1
           -m  "branch for release 1.0"

(all on one line, of course.) You should always make a branch of the entire trunk folder and contents. It is of course possible to branch sub-parts of the trunk, but this will almost never be a good practice. You want the branch to behave exactly like the trunk does now, and for that to happen you have to branch the entire trunk.

See a better summary of SVN usage at my blog: SVN Essentials, and SVN Essentials 2

Branching / Tagging, Of course to create a branch or tag you must copy the folder, not move it. Yet another way is from the log dialog. You can show the log dialog for e.g. trunk, select a revision (either the HEAD revision at the very top or an earlier revision), right click and choose create branch/tag from revision. Ensure your trunk does not have uncommitted changes. And that you finished working on your branch. And that you just finished updating your branch with the latest version of trunk. And that the stars are all aligned. Right-click over the trunk folder. Select TortoiseSVN > Merge…. A wizard window will appear. Select Merge a range of revisions. Next.

Could use Tortoise:

http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-branchtag.html

How to properly create an SVN tag from trunk?, Typically, branching can be used to try out and develop new features without disturbing the svn copy <https://subversion.assembla.com/svn/path/to/trunk> \ Browse through the repository to find the folder you want to tag (or branch). Copy the folder to your tagsor branchesfolder by holding down the Option(⌥) key while dragging the folder. An options window will appear when the folder is dropped. Specify the name of the tag or branch and the revision to copy from.

SVN Basics - Module 5: Tagging and Branching, I am creating my first project in Subversion. So far I have branches tags trunk. I think I immediately need to make branches singular and start over. Update  This example assumes that a /calc/tags directory already exists. (If it doesn't, you can create it using svn mkdir.)After the copy completes, the new release-1.0 directory is forever a snapshot of how the /trunk directory looked in the HEAD revision at the time you made the copy.

SVN - Tags, So we can use SVN's tagging feature and tag that same revision with the creating a repository here with Trunk, Branches and Tags folders. Tags in SVN are usually used to create a snapshot of a final product. For each release a tag might exist, so it is easier to revert to that particular release in case anything goes wrong with a

Difference between trunk, tags and branches in SVN , SVN - Tags - Version Control System supports the tag operation by using that Tom decides to create a tag so that he can access the code more easily. [tom@​CentOS project_repo]$ svn copy --revision=4 trunk/ tags/basic_array_operations that the tag operation is successful, so he can safely commit his changes. Select the folder in your working copy which you want to copy to a branch or tag, then select the command TortoiseSVN → Branch/Tag. The default destination URL for the new branch will be the source URL on which your working copy is based.

Comments
  • Unfortunately I don't make all the choices in this case... git is pretty damn magic.
  • The 1.1 version of the book is terribly outdated. Here's a better link: svnbook.red-bean.com/nightly/en/svn.branchmerge.tags.html
  • files copied does not spend any extra space
  • I marked this as answer. Just one extra note. You can get an previous revision of the trunk and "tag" it as well. the command: svn copy -r 123 "svn.example.com/project/trunk" "svn.example.com/project/tags/1.0" -m "Tagging, but using older revision (123)."
  • I get svn: Local, non-commit operations do not take a log message or revision properties, so I just remove the -m option.
  • Just an FYI, make sure that your url matches your repository including http or https.
  • Why the \ at the end of the first line?
  • @Jonny I am unable to run the above command without the "-m" option. I am using terminal on mac.
  • It is possible to use "Last Changed Rev": echo "{ 'svnRev': \"`svn info | awk '/Last Changed Rev:/{print $4}'`\" }" >svnver.txt `
  • This way, two branches with (of course) different revision numbers still produce the same software version.
  • Yes, you're right about Last Changed Rev, but that doesn't change the fact that by design there are no real tags in Subversion.