Introduction to SVN usage

Source: Internet
Author: User
Tags diff prev svn svn update

1. Basic Work Cycle:
A update of your working copy
$ SVN update
B Making changes
$ svn add/delete/copy/move
C Inspection Modification
$ svn Status/diff/revert
D merging other people's changes reverse working copy
$ svn merge/resolved
E to submit your amendment
$ SVN Commit

2. Actions to be made before submission:
$ SVN Status:
Check that the current working copy is out of date, and use the SVN diff to view the details.
$ SVN Update:
Incorporate other people's changes to the code into your local copy.

3. If you use SVN rm to delete files that should not be deleted, recover them.
A commit before: $ svn revert PATH
B after submission: $ svn copy-r PREV SRC DST

4. Add the files that should not be added, and how to delete the files.
A commit before: $ svn revert PATH
B after submission: $ svn Remove URL

5. If the code has been submitted, how to roll back to the previous version
A. Previous version:
$ svn cat-r PREV filename > FileName
Note that this time the file status is m, which means you can submit your changes.
B. Older versions:
$ svn update-r number
However, modifications within these work paths cannot be committed to the code base.

6. SVN does not add links under the current directory to version control, which means:
A. If you don't want to add some catalogs/files to version control, the easiest way to do this is to:
Create a directory somewhere else, and then link to that directory with a soft link in your SVN working directory
But at this point, if SVN status, the link file will have a hint.
B. If you find that a check out file lacks something,
That is most likely because the link class file/directory was not submitted at import time.

7. Dealing with conflicts
When you use SVN update, if you see a message that starts with C,
Indicates that you have overlapping local revisions and revisions in the version library,
In other words, you modify a line, and your co-workers change the same line.
This will require your own hand to solve.

When a conflict occurs, notice that there are three things you can do to help you solve the problem:
A. Subversion will give the document a C tag.
B. If subversion believes that the file can be merged, it will have a conflicting flag (a special horizontal line to separate the conflicting blocks of code).
C. For each conflicting document, Subversion places three additional versioned files into your working copy.

Filename.mine
Before you update the file, there are no conflicting flags, just the content of your latest changes.
(If this file cannot be merged, the. mine file will not be created because it is the same as the working file.) )
Filename.roldrev
This is the previous base version of your update operation, which you have not changed since you last updated.
Filename.rnewrev
This is the version that Subversion has just received from the server. This version is the head version of the version library.

To resolve this conflict, you can choose:
A. Manually merge conflicting files (check and modify conflicting flags in a file).
B. Overwrite your working document with a temporary document (one of three).
C. Run svn revert <filename> to discard all modifications.

Once you have resolved your conflict, you will need to command SVN resolved to let subversion know and delete three temporary files before submitting them.

For manual merge conflicts, look at the following text:
Mayonnaise
Lettuce
Tomato
Provolone
<<<<<<< mine
Salami
Mortadella
Prosciutto
=======
Sauerkraut
Grilled Chicken
>>>>>>> R2
Creole Mustard

A series of greater than, less than, equals numbers are conflicting tokens that have to be deleted before they can be submitted. which
<<<<<<< mine
Salami
Mortadella
Prosciutto
=======
It's the change you made in the conflict zone.

Sauerkraut
Grilled Chicken
>>>>>>> R2
It's someone else's change in the conflict zone.

In the conflict zone, perhaps you need to communicate with your colleagues to arrange the text of the conflict zone,
If it's a program code, you need to talk to your co-workers about what the middle piece of code should look like.
Once all the conflict zones have been properly resolved, you can submit your files.

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.