This article has participated in the call for good writing activities, click to see: the back end, the big front end double track submission, 20,000 yuan prize pool waiting for you to challenge!”

preface

The main function of version control is to track changes to files. It faithfully records information such as when and who changed what in a file. This chapter introduces the SVN

1. Introduction to SVN

Subversion(SVN) is an open source version control system, meaning that Subversion manages data that changes over time. These data are stored in a central repository. The archive works much like a regular file server, except that it remembers every change to a file. This way you can restore the file to an old version or browse the history of the file.

2. Some concepts of SVN

  • Repository: A centralized place where source code is stored.
  • Checkout: When no source code is available, you need a copy from Repository Checkout to modify and develop.
  • Commit: When code changes have been made, they need to be committed to repository.
  • Update: When you have checked out a source code, Update it with the Repository source code.

3. Main functions of the SVN

  • Directory version control
  • True version history
  • Automatically submit
  • Metadata for inclusion in version control
  • Select a different network layer
  • Consistent data processing
  • Valid branches and tags
  • Hackability

4. SVN check out operations

svn checkout http://svn.test.com/svn/project --username=username
Copy the code

After a successful checkout, a checkout directory is generated under the current directory. To view the checked out content, execute ll project /

5. The SVN resolves conflicts

When errors are found in the file, you need to modify the file and submit it to the repository. Conflict resolution operations need to be performed. First look at the differences in the files

svn diff
Copy the code

Then try to commit the changes using the following command:

svn commit -m "Change Remarks"
Copy the code

Subversion did not allow us to commit the code to avoid overwriting each other. Update the file.

svn update
Copy the code

At this point, the local and repository are in sync and you can safely commit your changes

svn commit -m "Change remarks again"
Copy the code

6. SVN submission operation

First put the file into version control

SVN add "File to be submitted"Copy the code

You can view the status of files in version control

svn status
Copy the code

Submit at the end

svn commit -m "Documents to be submitted"
Copy the code

7. The SVN version is rolled back

If you find a change error, you need to undo it and revert to the unmodified state using SVN REVERT

svn revert "Files to be rolled back"
Copy the code

Restore directory

svn revert -R "Directory file"
Copy the code

Undo back to previous version, now version 1008, back to version 1006

svn merge -r 1008:1006 readme 
Copy the code

8. SVN branch management

Create a branch

SVN Copy Version library/Branches/New branchesCopy the code

Commit the new branch to the repository.

svn commit -m "Add new branch" 
Copy the code

Branch merge

svn merge .. /branches/ New branches/Copy the code

9. The SVN displays historical information

  • SVN log: Displays the version author, date, and path of the SVN.
  • SVN diff: Used to display row-level details for specific modifications.
  • SVN cat: gets a file in a specific version to be displayed on the current screen.
  • SVN list: displays files in a directory or version.