What are the uses of svn copy

svnversion control


$ svn copy foo.txt bar.txt  
A    bar.txt
  • When would you use this technique, and why?
  • Will this command (taken from svn's "red book") creates a copy of <foo.txt> while preserving the history of it to be shared with <bar.txt>?
  • If I'm changing <bar.txt>, what will happen to <foo.txt>?

What are the equivalents to this in other modern systems (Clearcase, Accurev, Perforce)?

Let me emphasize the point I'm searching for:
Is this kind of branching out on a file level?
What happens if you use it in the same branch, i.e. create a copy of a file and than start changing that new file. all in the same branch?
I understand that it is also used for tagging but what is interesting me is what to expect when performing <svn copy> on the file level.

Best Answer

Aside from branching/tagging, you can also use it when you split a file in two. In this case both new files will have history and you'll be able to look at the code before the split.

BTW: that's one of few features that SVN has, but Git doesn't (Git will try to guess origin of code after the fact, especially if you add -C to commands).