SVN Quick Start Introduction to SVN Introduction and resolution of SVN configuration and usage conflicts

SVN

1. Introduction to SVN

  1. The full name is Subversion, which is a code version management tool
  2. Can remember every modification
  3. View all modified records
  4. Restore any historical version
  5. Recover deleted files

Two, SVN advantage

  1. Simple to use and quick to get started
  2. Directory-level permission control, security
  3. Can operate on subdirectories (Git can only operate on the entire warehouse)

Three, a few basic concepts

  1. checkout (check out): download the content of the server to the local, this command only needs to be used once when interacting with the server for the first time
  2. update: synchronize the new content in the server to the local
  3. commit (submit): After the content in the local is modified, submit it to the server
  4. Repository: The location where the source code is stored in the server, and the history of each modification

Four, SVN download and installation

  1. Download the SVN client installation package from the official website

Insert picture description here

  1. Download the Chinese package from the official website

Insert picture description here

  1. Download the SVN server installation package from the official website

Insert picture description here

  1. Install the above three installation packages

Note: When installing the SVN client, you need to check the corresponding content at this step (the compiler can be integrated with SVN)

Insert picture description here

  1. Use the right mouse button at any location, the following content appears, indicating that the installation is successful
    Insert picture description here

Five, SVN configuration and use

  1. Enter the VisualSVN server, click the following in the interface to configure

Insert picture description here

  1. The value of Server name can be set as:

(1) 127.0.0.1 (can only be accessed locally)

(2) Computer user name (can only be accessed locally)

(3) Current IP address (all users who can ping this IP can access)

Insert picture description here

  1. New account, password

Insert picture description here

  1. New group

Insert picture description here

  1. New repository

Insert picture description here
Insert picture description here

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

  1. Import the project into the server's repository (import)

(1) The address of the copy server warehouse

Insert picture description here
Insert picture description here

(2) Select the project in the disk that needs to be uploaded to the server

Insert picture description here

(3) Paste the address copied in the first step to the corresponding location

Insert picture description here

(4) Choose to accept permanently

Insert picture description here

(5) Enter the account and password of the user created above, indicating that this is the zhangsan user importing the project to the server

Insert picture description here

(6) Import completed

Insert picture description here

(7) View the imported project after refreshing in the SVN server

Insert picture description here

  1. Synchronize the items in the server to the local for the first time (checkout)

(1) Copy the address of the project to be synchronized in the server

Insert picture description here

(2) Create a directory on the disk to store the items synchronized from the server, right click on the blank space of this directory

Insert picture description here

(3) Enter the remote address and set the output directory of the project

Insert picture description here

(4) The checkout is complete, and there are corresponding items in the server in the disk

Insert picture description here

  1. Submit the locally modified content to the server (commit)

(1) Create a new hello.txt file locally, right-click this file twice

Insert picture description here

(2) Select the file to be submitted

Insert picture description here

(3) The submission is successful, and the newly added content in the local is successfully synchronized in the server
Insert picture description here

  1. Synchronize the new content in the server to the local (update)

(1) Right-click on a blank space in the local disk
Insert picture description here

(2) Successful update

Insert picture description here

Six, the description of the SVN icon

  1. General icon

Insert picture description here

This icon is displayed when the local file is exactly the same as the server file

  1. Conflict icon

Insert picture description here

This icon is displayed when the file submitted locally conflicts with the server-side data

  1. Delete icon

Insert picture description here

When the server-side data has been deleted, this icon is displayed

  1. Add icon

Insert picture description here

When the newly added file locally has been added to the submission queue, this icon is displayed

  1. No version control icon
    Insert picture description here

When the newly added file is not added to the upload queue, this icon is displayed

  1. Edit icon
    Insert picture description here

When the local file has been modified but not submitted, this icon is displayed

  1. Read only icon

Insert picture description here

When the local file exists in read-only form, this icon is displayed

  1. Lock icon

Insert picture description here

When the server-side data is locked, this icon is displayed

  1. Ignore icon

Insert picture description here

When the local file has been ignored and does not need to be submitted for upload, this icon is displayed

7. Introduction to conflict issues

  1. Causes of conflict

Suppose that both users A and B update the hello.txt file when the version number is 100. User A submits hello.txt to the server after the modification is completed. The submission is successful. At this time, the version number of the hello.txt file is It has become 101; at the same time, user B makes modifications on the hello.txt file with version number 100. When the modification is completed and submitted to the server, the submission fails because it is not the modification made on the current 101 version; at this time User B updates the file. If user B and user A modify the same line of code in the file, there will be a conflict

  1. Conflict file existence form

The conflict file hello.txt will derive the following four files:

(1) The last version hello.txt.r100
(2) Others have submitted an updated version hello.txt.r101
(3) My own updated version hello.txt.mine
(4) The conflict file itself hello.txt

After the conflict is resolved, only hello.txt will remain after the conflict is resolved

  1. Simulate conflict scenarios

(1) Execute the update command on the local disks of users A and B to update the content to the latest

(2) The original content of the hello.txt file is as follows

Insert picture description here

(3) User A modifies hello.txt and commits to the repository
Insert picture description here

(4) User B modifies hello.txt and commits to the repository
Insert picture description here

(5) The following error occurs when user B commits to the server

Insert picture description here

(6) User B should execute the update command to update the version, obtain the four derivative files of the conflicting file and resolve the conflict

8. Resolution of conflicts

  1. User B executes the update command in the project directory on the disk

Insert picture description here

  1. The following files appear in the project directory of user B
    Insert picture description here

  2. Right click on the conflicting file

Insert picture description here

  1. Pop-up editing conflict window

Insert picture description here

  1. If you want to use the server version, right-click in the Theatre window and select Use this text block; if you want to use the local version, right-click in the Mine window and select Use this text block; the final selection will be saved in the merge window

Insert picture description here

  1. After the modification is completed, proceed as shown in the figure below to resolve the conflict

Insert picture description here

  1. After the conflict is resolved, only the files after the conflict are resolved, and the derived files disappear automatically

  2. User B executes the commit operation again and can submit to the server

Insert picture description here

Note: Frequent commit and update can reduce the probability of conflicts

Guess you like

Origin blog.csdn.net/weixin_49343190/article/details/112465529
svn