How to add files to SVN

From The DarkMod Wiki
Jump to: navigation, search

After reading this article you should be able to add files to the darkmod SVN repositories. It's assuming that you have a working copy of the darkmod SVN repository checked out on your hard drive and you're using TortoiseSVN.

Things to remember:

  • Add the files/folders to the target folder.
  • Be sure the names are the way you want them, later renaming is tiresome.
  • Highlight the files, right-click one of them and choose SVN > Add..., hit OK.
  • Commit your change (right-click the parent folder and choose SVN Commit...)


Normally, SVN will ignore all files in the folder of your working copy that are not under version control. Commits won't affect the files, that's why you need to specifically tell SVN to consider these files.

Add the files/folders to the Target Location

Let's assume we want to add a new file to the darkmod repository, named test.def. Create the file in the def/ folder using your favourite text editor or copy the file from somewhere else, in case you already created it.

The file sits there, note that it's missing its SVN icon, meaning that it is not yet under version control:

Svn add 1.jpg

Add the files to the Working Copy

Best practice: Be sure to check the spelling and the case of your filename you're about to add. Renaming versioned files is of course possible, but it's better doing it right the first time.

Now right click the file and choose SVN > Add.... This will bring up a new dialog showing the candidates for addition. Hit OK.

Svn add 2.jpg >> Svn add 3.jpg >> Svn add 4.jpg >> Svn add 5.jpg

The file is now marked for addition and will be considered during the next commit. Note that a small blue plus sign has been added to the file symbol (if you don't see it, hitting F5 to refresh the folder view might do the trick).

Commit the new Objects

Now, right-click on the new file's parent folder (in our example the def/ folder) and choose SVN Commit..., you'll see something like this:

Svn add 6.jpg

Note the remark "added" in the list of affected files. Enter a log message (if you forget, the commit will fail) describing the purpose of your commit. As soon as you click OK, the file will be uploaded to the SVN Server. VoilĂ .

Accidentally added files

In case you added the wrong file to version control, you can undo that operation (before you commit) by choosing SVN > Revert. Right-click the parent folder, choose revert and be sure that the check mark next to the accidentally added file is active. Hitting OK will release the file from version control again.

In case you already committed the wrong file, you'll have to specifically delete the file from the repository again, see the article How to delete files from SVN for further details.

Personal tools