How to add an existing folder with files to SVN?

后端 未结 7 884
伪装坚强ぢ
伪装坚强ぢ 2020-12-12 13:15

How do you add a folder without version control to a specific SVN location? I often start writing code and only after I have a few folders containing code files do I add it

相关标签:
7条回答
  • 2020-12-12 13:22

    Let's try.. It is working for me..

    svn add * --force
    
    0 讨论(0)
  • 2020-12-12 13:23

    If I correctly understood your use case, I suggest to try using svn add to put the new folder under version, see here. The following will add the new folder with files recursively under version control (if you are inside valid working copy):

    svn add new_folder
    svn commit -m "Add New folder to the project"
    

    If you are not in a working copy, create it with svn checkout, copy new_folder there and do the above steps.

    OR

    Try svn import, see here; the following will create a new folder and upload files to the repository:

    svn import -m "Import new folder to the project" new_folder \
            http://SVN_REPO/repos/trunk/new_folder
    

    Also note that:

    After importing data, note that the original tree is not under version control. To start working, you still need to svn checkout a fresh working copy of the tree

    0 讨论(0)
  • 2020-12-12 13:24

    Let's say I have code in the directory ~/local_dir/myNewApp, and I want to put it under 'https://svn.host/existing_path/myNewApp' (while being able to ignore some binaries, vendor libraries, etc.).

    1. Create an empty folder in the repository svn mkdir https://svn.host/existing_path/myNewApp
    2. Go to the parent directory of the project, cd ~/local_dir
    3. Check out the empty directory over your local folder. Don't be afraid - the files you have locally will not be deleted. svn co https://svn.host/existing_path/myNewApp. If your folder has a different name locally than in the repository, you must specify it as an additional argument.
    4. You can see that svn st will now show all your files as ?, which means that they are not currently under revision control
    5. Perform svn add on files you want to add to the repository, and add others to svn:ignore. You may find some useful options with svn help add, for example --parents or --depth empty, when you want selectively add only some files/folders.
    6. Commit with svn ci
    0 讨论(0)
  • 2020-12-12 13:25

    If the intention is adding the local/working copy to SVN, I used to do it the following way.

    Note: I use the TortoiseSVN client and these steps assume that you already have the TortoiseSVN client installed.

    1. I have a project (Test-4.2.2) in my local. I want to upload/add it to an SVN repository.
    2. Using the TortoiseSVN repo-browser, I created an empty directory, "Test-4.2.2"
    3. In my local I renamed the existing "Test-4.2.2" directory to "Test-4.2.2.1" (temporary)
    4. Checkout the empty "Test-4.2.2" from SVN to your local
    5. Copy all the sub-directories under 4.2.2.1 to this checkout directory 4.2.2
    6. Now, right click "Test-4.2.2" and commit.
    7. Delete the temp folder, "Test-4.2.2.1"
    0 讨论(0)
  • 2020-12-12 13:27

    I don't use commands. You should be able to do this using the GUI:

    • Right-click an empty space in your My Documents folder, select TortoiseSVN > Repo-browser.
    • Enter http://subversion... (your URL path to your Subversion server/directory you will save to) as your path and select OK
    • Right-click the root directory in Repo and select Add folder. Give it the name of your project and create it.
    • Right-click the project folder in the Repo-browser and select Checkout. The Checkout directory will be your Visual Studio\Projects\{your project} folder. Select OK.
    • You will receive a warning that the folder is not empty. Say Yes to checkout/export to that folder - it will not overwrite your project files.
    • Open your project folder. You will see question marks on folders that are associated with your VS project that have not yet been added to Subversion. Select those folders using Ctrl + Click, then right-click one of the selected items and select TortoiseSVN > Add
    • Select OK on the prompt
    • Your files should add. Select OK on the Add Finished! dialog
    • Right-click in an empty area of the folder and select Refresh. You’ll see “+” icons on the folders/files, now
    • Right-click an empty area in the folder once again and select SVN Commit
    • Add a message regarding what you are committing and click OK
    0 讨论(0)
  • 2020-12-12 13:34

    In Windows 7 I did this:

    1. Have you installed SVN and Tortoise SVN? If not, Google them and do so now.
    2. Go to your SVN folder where you may have other repos (short for repository) (or if you're creating one from scratch, choose a location C drive, D drive, etc or network path).
    3. Create a new folder to store your new repository. Call it the same name as your project title
    4. Right click the folder and choose Tortoise SVN -> Create Repository here
    5. Say yes to Create Folder Structure
    6. Click OK. You should see a new icon looking like a "wave" next to your new folder/repo
    7. Right Click the new repo and choose SVN Repo Browser
    8. Right click 'trunk'
    9. Choose ADD Folder... and point to your folder structure of your project in development.
    10. Click OK and SVN will ADD your folder structure in. Be patient! It looks like SVN has crashed/frozen. Don't worry. It's doing its work.

    Done!

    0 讨论(0)
提交回复
热议问题