Introduction
Learning SVN for work purposes. SVN is a C/S type version management system that heavily depends on servers. Most operations are related to the SVN server.
Most Common Operation Flow
Here we assume the server project address is svn://192.168.1.1/shop
- Checkout the project
- Update: update the server project to local
- Commit: submit local changes
How to Deploy an SVN Server
Since SVN is a C/S type software, you need to deploy a server to use it. So we need to set up a server for testing. To keep it as simple as possible, we’ll install VisualSVN software on Windows to act as our server. Note that servers usually run on Linux, but we’re using Windows server software here just for ease of getting started. You can easily download VisualSVN Server software from the official website. I downloaded version 3.9. Use the latest stable version. During installation, there’s a step to select the standard edition; for other steps, just use the defaults. Pay attention to the port selection to avoid conflicts with ports on your machine. The default port is 443, but you can change it to 8443.
Creating a Test Project on the Server
Since an SVN project is a repository, which is a folder, we need to create a folder. Open the D:\Repositories folder and run the command svnadmin create test1
in that directory to create a project. For other users to access this directory, you need to use the svnserve
command to start the server, which we’ll discuss later. You also need to configure permissions. Open the svnserve.conf file in the conf directory under test1, uncomment anon-access, and change its value to write. This allows anonymous access with write permissions.
Then run the command in the D:\Repositories directory:
svnserve -d -r ./test1
This step opens the SVN server’s listening state.
Common SVN Client Operations
Download and install TortoiseSVN.
-
Checkout Right-click in the directory you want to synchronize, select repo-browser from TortoiseSVN, enter svn://127.0.0.1, and confirm. Right-click on the folder icon and select checkout, then confirm. The checkout is now successful.
-
Commit Add a txt file and write something in it. Then right-click and select commit. This will commit to the server.
-
Update After developer A submits data and the server changes, developer B needs to synchronize. Right-click and select update.
-
Ignore To exclude files from being committed, right-click on the file and select “add to ignore list”
SVN Versions
SVN versions start from 1 and increment. SVN can roll back versions. SVN can perform branch and merge operations, but these differ significantly from Git’s branch operations. It seems like it creates a new project. The final merge only combines conflicts. This is different from Git’s branch operations, which are based on diffs.