SVN use tutorial

Source: Internet
Author: User

1. Subversion Introduction

Subversion is a new generation of version control tools that are gradually replacing CVS.Official website: http://subversion.tigris.org/Subversion Chinese Station: http://www.subversion.org.cn/Chinese Manual: http://www.subversion.org.cn/svnbook/Subversion vs. CVS: http://www.uml.org.cn/pzgl/200705251.asp2. Subversion Basic use2.1. Subversion installation Subversion is a typical C/S mode application.installation package in Windows: Http://subversion.tigris.org/files/documents/15/41687/svn-1.4.6-setup.exeThe installation process is simple, the graphical interface, the default choice can be.Enter the SVN command to see if the installation was successful:SVN--versionThe SVN command is the client of the Subversion program.Svnserver command to start the SVN server for a simple SVN server environmentSee: Http://www.easymorse.com/bbs/viewthread.php?tid=95&extra=page%3D1

2.2. Server-side

The following is a simple server-side environment to build the practice, formally with Apache through HTTP access. 2.2.1. Creating a repository creates a server-side repository, which is equivalent to a DBMS creating a database sample. command line:

svnadmin Create File_path/repo_name

2.2.2. Starting the server

Svnserve.exe-d-R File_path

-D background execution, -r version Library root directory

Access to the repository's Url:svn//localhost/repo_name

2.3. Client

2.3.1. Initial imports (Import)

Import from the command line:SVN import-m "init import" http://10.0.0.6/svn/teaching/This command imports the files under the current path into the repository.2.3.2. Checking out (checkout)Check in with the command line:SVN Co http://hibernate3demo.googlecode.com/svn/tags/helloworld_r1 or:SVN checkout http://hibernate3demo.googlecode.com/svn/tags/helloworld_r1 or: Checked out by a third-party graphical tool, such as TORTOISESVN (/HTTP// tortoisesvn.tigris.org/) Download the latest revision of the SVN server to a local working copy locally.2.3.3. Keeping updates (update)Command line:SVN updateOrSVN upor through TORTOISESVN.or via the Eclipse plugin, subclipse (http://subclipse.tigris.org/), installed online: http://subclipse.tigris.org/update_1.2.x/Update the local working copy with the latest revision of the SVN server.2.3.4. Adding (ADD)Command line:SVN add File_pathor through the Tortoisesvn,eclipse plugin.Inform the SVN server, add directories and/or files to the server, this operation is similar to SQL INSERT, but there is no real operation until commit.2.3.5. Submitting ChangesEquivalent to the general concept: check-in (checkin).Command line:SVN commitOr:SVN cior through the Tortoisesvn,eclipse plugin.Commits all changes to the local working copy, and is atomic in nature.Requirements: Generally note the reasons for the changeSVN ci-m "fix bug #224"Requirements: To be updated before submittingSVN upSVN ci-m "fix bug #224"2.3.6. Revert changescorresponding commit (commit), there is a similar rollback (rollback) operation.svn revertor through the Tortoisesvn,eclipse plugin.This operation is very useful to developers, and can be "one-click Recovery" After a lot of code has been changed.2.3.7. "Revert" a committed changeRevert is only suitable for uncommitted situations.If you have already submitted, you find the problem and you want to fall back to the previous revision.First, you need:SVN upUpdate the local working copy to the latest state.And then:SVN log Your_file_pathLook at the file log, which is where the information you fill out when you submit it comes in handy.See the differences between the two revisions:SVN diff-r Old revision sequence number: New revision number Your_file_pathor through the Tortoisesvn,eclipse plugin.After deciding which old revision number to use, overwrite the new revision number file with the old revision number file.SVN merge-r New revision sequence Number: Old revision number Your_file_pathAlso need to:SVN commit-m "revert to a revision (void of a revision)"or through the Tortoisesvn,eclipse plugin.This restore is so-called, instead of replacing the old version number, overwrite the old file with the new one.2.3.8. Copying files and directoriesCommand line:SVN copy path/file_name Newpath/new_file_nameSVN commit-m "xxxx"Or:SVN cp path/file_name Newpath/new_file_nameSVN commit-m "xxxx"Or: Using the Windows Explorer/unix CP commandor through the Tortoisesvn,eclipse plugin.SVN copy is a very important tool, and the concepts of version branching and labeling are implemented through it .。The copy of SVN is a cheap copy.2.3.9. Renaming a directory/fileCommand line:SVN move file_name new_file_nameOr:SVN mv file_name new_file_name2.3.10. Handling merge ConflictsSVN does not lock files by default.If different people edit different parts of the same file, they are automatically merged when they are submitted.If a different person edits the same part of the same file, the submitter reports a merge conflict.Workaround (manual quorum):? waiver of changes;Stick to your changes, find the. mine file name, revert to the original file name, and then execute: SVN resolved file_name2.3.11. deleting filesDelete the local working copy.Command line:SVN delete File_pathOr:SVN del File_path3. Subversion Advanced Content3.1. File lockGenerally used for binary content because it cannot be merged.If a file is locked, the other user's local working copy (updated) will be read-only.When the user submits, the local working copy of the other user (after the update) can be written.Other users can "pry the lock" and then write.Advanced Configuration You can configure the "pry lock" permission so that no one can "pry" the lock.3.2. Using labels and branchesIn SVN, both the label and the branch originate from the Copy command.3 Conventional Directories: Trunk : Trunk ? Branches: Branch ? Tags: tagsRelease Branch:svn cp-m "Creating a branch for implementing radio tags" https://test/svn/trunk https://test/svn/branches Switch branch:SVN switchhttps://test/svn/branchesmerging a branch requires two steps: merge Operation svn merge-r 33:head https://test/svn/branchessubmissions from the Web, learning from each other

SVN use tutorial

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.