Linux Learning Chat (iii)--SVN usage and cut and close versions

Source: Internet
Author: User
Tags diff svn svn client svn update using git version control system

Linux Learning Chat (iii)

--SVN usage and cut and close versions

(Reproduced please attach this article link--linhxx)

SVN is an integral part of the project, with many people collaborating on projects, project versioning, and more. Although many projects are using git recently, SVN is still a popular version control system. One of the biggest advantages of SVN versus git is the existence of a global version number.

I. Overview

SVN is divided into clients and servers, that is, the need to install the SVN server on an all-you-can-access service, and then install the SVN client on each computer. The installation process does not speak here, there are a lot of blogs such as http://www.cnblogs.com/xiaobaihome/archive/2012/03/20/2407610.html speak well.

II. basic Commands

1. Get the Code

SVN checkout SVN version path. Checkout can be abbreviated as CO.

This command is used to obtain the code for a version path on the SVN server.

2. Update code

SVN update [path/filename]. Update can be abbreviated to up.

This command is used to get the latest content of a file on a path on the SVN server, and if you do not add the path and the file default gets all the contents of the latest version of SVN server.

3. Submit the code to the temporary path

1) SVN add file name.

The newly added file needs to be submitted to the temporary path using this method to submit the new file.

2) SVN delete file name. Delete can be shortened to Del or RM.

To delete a file, you need to use this method to tell the temporary path that the file is about to be deleted.

4. Submit code to SVN server

SVN ci–m ' comment ' file name. Commit can be abbreviated as CO,-M is used to add notes, it is recommended that each commit, you need to submit comments, so later when there is a problem, it is easy to find the reason.

After the 3rd add and delete commands are finished, they must be submitted to the server using the commit command before it takes effect. In addition, the files that are usually modified will require a commit to take effect.

5. Conflict resolution

SVN resolve

When svn up acquires SVN CI, it is assumed that there is a conflict in the file my.php, you will receive the following prompt: Select: (p) delay, (DF) Show all differences, (e) Edit, (MC) My version, (TC) Others version, (s) Show all options.

If you want to discard your edits, you can choose TC, if you have determined that others do not need their changes, you can choose MC. However, it is common to select p to defer and then generate a MY.PHP.MINE,MY.PHP.R version number, MY.PHP.R this version number, my.php. You can use VI to open my.php, you will find <<<<<<<, =======, >>>>>>> similar to the division, marked their own changes and other people's changes.

After the modification is complete, delete <<== >> these tokens and useless auto-generated notes, use the following command, SVN resolve–accept working my.php, tell SVN that the conflict has been resolved, and automatically delete those generated files. Then use SVN ci for submission.

If you can't determine whether to keep the other person's modifications, you'll need to ask the person who made the change to see the problem.

6. Other commands

1) SVN diff file name, diff can be abbreviated to DI, the command is used to compare the file under the current path with the SVN server corresponding to the path of the file under the difference, can be specific to each row, will show the contents of the difference. If you do not enter a file name, all files are compared.

In addition, you can compare the differences between two versions with SVN di–r version 1: Version 2 file name, by default comparing the differences between the local version and the current SVN server version.

This method is recommended before commit, and can be handled in advance if there is a conflict.

2) SVN convert file name.

This command restores a file to the version of the SVN server, which causes local modifications to be lost, which is equivalent to the RM file name + SVN up file name. Delete the document and retrieve it again.

In addition, SVN convert–recursive * can return all the original files.

3) SVN mkdir folder name.

This method creates a folder in the SVN temporary path, which is equivalent to the MkDir folder name + SVN Add folder name.

4) SVN cat file name.

This method does not check out the file, only the contents of the file on the server.

5) SVN status. The status can be shortened to St or stat.

This command is used to view the differences between the local SVN replica and the SVN server under the current path, and the result is an English letter + filename, which is the file name of the local file that is inconsistent with the SVN server.

English alphabet: M-Modified, U-line has updates, a-new, D-Delete,?-local additions have not been added to the SVN temp path, C-conflict.

7. View Logs

SVN log file name. This command looks at the log information for all versions of the file commit: version, author, date, comment. If the file name is not added, the version information for all files.

Third, branch merging and cutting version

1. Overview

In large projects, the version is usually divided into tags, trunks, branches three kinds.

tags represent snapshots, which are versions of the current production system on the line, and are usually not developed under this type unless it is urgently on-line.

Trunks represents the current major version, and branches is the branch version. Usually collaborators are developed on their own branches and synchronized with trunks in a timely manner, and are updated from trunks before each development.

Therefore, branch merging is usually referred to as trunks merging to tags, and the tangent branch usually refers to trunks copying a copy of the branches.

2. Command

1) Merging branches

SVN merge Path 1 path 2 [merged path]. The default is merged into the current path.

This method merges two files. It is recommended that you do svn up before using this command, and then point to the conflict after it is resolved, or the merge fails.

In addition, after SVN merge, only merge to the staging path, you need svn ci to submit to the SVN server.

2) Cutting branches

The path –m ' comment ' after the SVN copy master path is copied. Copy can be shortened to CP.

This command copies the files on the server to a working copy locally, and the server does not save the files, only one node that points to the file.

--written by Linhxx

More recent articles, please pay attention to the public number "machine learning", or scan the right QR code.

Linux Learning Chat (iii)--SVN usage and cut and close versions

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.