SVN notes 1

01 some concepts

repository (source code library): the unified storage place of the source code
Checkout (extract): when you do not have the source code on hand, you need to checkout a
Commit (submit) from the repository : when you have modified the code, you need Commit to repository
Update (Update): When you have checked out a source code, you can synchronize with the source code on the Repository once you update, and the code in your hand will have the latest changes

02 Install SVN under windows

  • Prepare svn installation file
    Download link: https://sourceforge.net/projects/win32svn/
  • After the download is complete, there will be a Setup-Subversion-1.8.16.msi file in the corresponding drive letter. The latest version is 1.8.16, and this version is used here. Then double-click the installation file to install it. We specify to install in the D:\Program Files (x86)\Subversion directory.
  • View directory structure
  • Add the bin directory in the svn installation directory to the path path, enter svnserve --help in the command line window, and check whether the installation is normal or not.
    At this point, the installation of SVN under windows is complete

03 SVN life cycle

  • Creating a version library The
    version library is equivalent to a centralized space for storing all the work results of the developers. The version library can not only store files, but also includes the history of each modification, that is, the change history of each file.
    Create 操作是用来创建一个新的版本库. In most cases, this operation will only be performed once. When you create a new repository, your version control system will ask you to provide some information to identify the repository, such as the location where it was created and the name of the repository.

  • Check out
    Checkout 操作是用来从版本库创建一个工作副本. The working copy is the developer's private workspace, where you can modify the content and then submit it to the repository.

  • Update
    As the name suggests, it update 操作is used to update the repository. This operation will 工作副本与版本库进行同步. Since the repository is shared by the entire team, when others submit their changes, your working copy will be available 过期.
    Let us assume that Tom and Jerry are two developers of a project. They also checked out the latest version from the repository and started working. At this point, the working copy is fully synchronized with the version library. Then, Jerry completed his work very efficiently and submitted the changes to the repository.
    At this point Tom's working copy has expired. The update operation will pull Jerry's latest changes from the repository and update Tom's working copy.

  • Performing changes
    After checking out, you can do many things to perform changes. Editing is the most common operation. You can edit existing files, such as adding/deleting files.
    You can add files/directories. However, these added file directories will not immediately become part of the repository, but will be added to the list of pending changes, and will not become part of the repository until the commit operation is executed.
    Similarly you can delete files/directories. The delete operation immediately deletes the file from the working copy, but the actual deletion of the file is only added to the pending change list, and will not be deleted until the commit operation is executed.
    The Rename operation can change the name of the file/directory. The "move" operation is used to move files/directories from one place to another in the repository.

  • Reviewing changes
    When you check out or update your working copy, your working copy is fully synchronized with the repository. But after you make some changes to your working copy, your working copy will be newer than the repository. It is a good habit to review your changes before commit operation.
    Status 操作列出了工作副本中所进行的变动. As we mentioned before, any changes you make to your working copy will become part of the pending changes list. The Status operation is used to view this list of pending changes.
    The Status operation only provides a list of changes, but does not provide detailed information about the changes. You can diff 操作view the details of these changes.

  • Fixing errors
    Let's assume that you have made many changes to your working copy, but now you don't want these changes. At this time, the revert operation will help you.
    The Revert operation resets the modification to the working copy. It can reset one or more files/directories. Of course it can also reset the entire working copy. In this case, the revert operation will destroy the pending change list and restore the working copy to its original state.

  • Resolve conflicts Conflicts
    may occur during merging. The Merge operation will automatically handle things that can be safely merged. Others will be treated as conflicts. For example, the "hello.c" file was modified on one branch and deleted on another branch. This situation needs to be dealt with manually. The Resolve operation is used to help users find conflicts and tell the repository how to deal with these conflicts.

  • Commit changes
    Commit operation is used to change from the working copy to the repository. This operation will modify the contents of the repository, and other developers can view these modifications by updating their working copy.
    Before submitting, you must add the file/directory to the list of pending changes. The changes that will be submitted are recorded in the list. When submitting, we usually provide a comment to explain why these changes were made. This comment will also become part of the history of the repository. Commit is an atomic operation, which means that either a complete commit succeeds, or it fails and rolls back. The user will not see half of the successful submission.

Guess you like

Origin blog.csdn.net/qq_41363459/article/details/111413890
svn