Tag Archive for 'add'

Adding and Deleting Files from the Command Line

When working with files under Apache Subversion’s version control, eventually you will need to start adding and removing files from your project. This week’s tip explains how to add a file to a project at the working copy level or, alternatively, commit it straight to the central repository. It will also highlight how to delete a file, either by scheduling it for deletion via the working copy or deleting it straight from the central repository.

Adding Files

Files can be added to a project via the working copy. After you’ve added the file to your working copy, it’ll be sent to the central repository and shared with the rest of your team the next time you perform an ‘svn commit.’

To add a file to your working copy (and schedule it for addition the next time you perform a commit) run:

svn add (working-copy-location)/file-to-be-added

In this example we’re adding a file called ‘executable’ to the trunk directory of the ‘NewRepo’ working copy.

Subversion 1

You’ll need to perform a commit to send this item to the repository and share it with the rest of your team.

Subversion 2

Deleting Files 

Once you start adding files to your working copy, sooner or later you’ll need to remove files. When files are deleted in the working copy, they’re scheduled for deletion in the repository the next time you perform a commit, in exactly the same way as the ‘svn add’ command.

Schedule files for deletion in the working copy by running:

svn delete (working-copy-location)/file-to-be-deleted

In this example, we’re scheduling ‘executable.png’ for deletion.

Subversion 3

Alternatively, you can delete files from the repository immediately. Note, this operation creates a new revision and therefore requires a log message.

svn delete -m “log message” (repository-URL)/file-to-be-deleted

Subversion 4

Looking for an easy-to-use cross platform Subversion client? Claim your free 30 day trial of SmartSVN Professional by visiting: www.smartsvn.com/download

Adding and Removing Files in SmartSVN for Windows

When working with SmartSVN, sooner or later you’ll need to add and remove files from your project. In this article, we show you how to add a file to SmartSVN and place it under version control, before demonstrating how to remove a file from the repository. Finally, we cover adding a file to SmartSVN’s ignore list, which is useful when you need to include a file in your project without placing it under version control.

Adding a File in SmartSVN

1) Outside of SmartSVN, select the file you wish to add and drop it into the working copy on your local machine.

 

 

 

 

 

 

2) Open your working copy with SmartSVN. The new file will appear as an unversioned item. Select the file, followed by the ‘Add’ button. Alternatively, you can right-click the unversioned file and select ‘Add.’

 

 

 

 

 

 

3) Commit your change back to the repository to make it permanent.

 

 

 

 

 

 

4) Don’t forget to add an appropriate log message!

 

 

 

 

 

 

 

Removing Files in SmartSVN

If you can add files, at some point you will need to remove them.

1) Select the file you wish to remove and click SmartSVN’s ‘Remove’ button. Alternatively, right-click the file you wish to remove and select the ‘Remove’ option.

 

 

 

 

 

 

2) In the subsequent dialog, select whether you wish to remove the file from version control, which will schedule the item for removal, or remove the control and also delete it locally.

In this example, we’ll choose to delete the file locally. Select ‘Remove.’

 

 

 

 

 

 

3) Commit your changes back to the repository to make them permanent.

Note, if you have opted to delete the file locally, it will disappear from both your working copy and the repository at this point.

Adding a File to SmartSVN’s Ignore List

If you have added a file to your working copy but don’t want to place it under version control, it may be worth adding to SmartSVN’s ignore list. This will prevent you from receiving a notification about the unversioned file every time you perform a commit.

To add a file to SmartSVN’s ignore list:

1) Select the file you wish to ignore.
2)
Open the ‘Modify’ menu and click ‘Ignore…’
3)
Choose either ‘Explore Explicitly,’ which will add the selected file/directory to the ignore list, or ‘Ignore As Pattern’ which instructs SmartSVN to ignore all files with a certain naming convention.
4)
Select ‘Ok’ to add the file(s) to SmartSVN’s ignore list.

Tip. If you cannot access the ‘Ignore’ option, check you are not attempting to ignore a previously committed file. You can only ignore unversioned files.

Remember that a free download of SmartSVN Foundation is available. Simply visit http://smartsvn.com/ to get started.