How to add parent directory in SVN?

Let's say I have such a directory structure

dir1
   dir2
   dir3

dir2already under version control, while dir1not. Now I understand what I would like to have dir1also under version control (and maybe later dir3, etc.). How can I do this and correctly reflect the changes in the repository?

If I just move dir2from dir1, add dir1to SVN and move dir2back to dir1, this will probably destroy version history dir2. What makes it even more complicated is that it dir2contains many files that are not under version control (they are ignored), therefore dir2it cannot be (completely) recreated from the repository.

+3
source share
4 answers

You are right, re-importing dir2 will not save the history of your existing dir2.

This should do the trick (assuming the path is a url repository):

  • svn mkdir path / dir1
  • svn mv path / dir2 path / dir1
+2
source
  • create dir1besidesdir2
  • move dir2todir1

You can do this on the server (using URLs) or in your working copy (using file system paths). In the latter case, you will have to commit later.

0
source

, , : SVN.

  • dir1.

  • dir2 SVN, dir1:

-

$ svn propget svn:externals dir1
dir2  svn://repository/dir2
0

svn add --parents dir1/dir2

0

Source: https://habr.com/ru/post/1721115/


All Articles