Use of svn in linux

Source: Internet
Author: User

1. The basic concepts of svn will not be detailed here. The next generation of CVS.

2. Basic commands

(1) Search for help svn help

View the help svn help import. Here we have detailed usage of the import command.

(2) svn import

Add a project to svn. For example

Svn import testproject [url | file path]

Note: testproject is the project directory path.

(3) svn co [url | path]: checkout code from svn

(4) svn add foo

Add foo to the project. If foo is a directory, all files will be added. If you only want to add the directory itself, svn add foo -- non-recursive

Svn delete foo

Opposite to add

Svn move foo foo1 renamed (similar to linux mv)

Svn mkdir blort: create a directory

(5) Check for modifications

Svn status: check which files you modified

Svn diff: list the modification details of each file

Generate patchfile

Svn diff> pathfile

Diff for specific versions

Svn diff-r 3

Compare the diff of two specific versions

Svn diff-r 2: 3

(6) Update code and resolve conflicts

Svn up or svn update

(7) submit changes

Svn commit

(8) Check history

Svn log

(9) browse the version Library

Svn list

Svn cat

3. Version Management

(1): The svn version number is a type of number and can also be expressed with a specific keyword.

HEAD: the latest version.

BASE: Version Number of one entry in a work copy.

COMMITTED: the latest revision of the project, which is the same as or earlier than the BASE.

PREV: A version earlier than commit

For example, if you want to view the latest version of modification

Svn log-r HEAD. The HEAD is interpreted as the latest version number.

(2) Use time to find the version number

Svn log-r {2011-04-01 }:{ 2011-04-22}

4 branch and merge

Each project directory contains a trunk directory and a branch branches directory.

When a project is large and there are multiple developers, it is easy to cause confusion when everyone is developing in the main directory.

When you develop a function module by yourself, the function can be completed only after a long development cycle,

At this time, you cannot submit unfinished code to the trunk, which may cause confusion. Now you can open a branch,

Then work in your branch directory.

(1) create a branch

Svn copy [url] [url]

Eg: svn copy http://svn.example.com/repos/calc/trunk http: // svn.example.com/repos/cal/branches/my-calc-branch

At this time, it is not really a copy, but a link, called a cheap price reset.

At this time, you can check out the code from your branch directory and perform the work.

Svn co http: // svn.example.com/repos/cal/branches/my-calc-branch.

(2) working on the branch,

Svn commit is supported, which does not affect the trunk.

(3) merge branches:

When you have a long development cycle and the trunk code has been handed over, if the time is too long,

It is very likely that your branch is out of touch with the trunk. At this time, you need to merge the code of the trunk update to your branch.

Svn merge url

Example: svn merge http://svn.example.com/repos/calc/trunk

Merge the master part update code to your branch.

 

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.