Source Code Control Tools Svn

Source: Internet
Author: User
Tags svn client svn update

Basic operations


1. Checkout only need to do once!
2. Daily before work: Commit "Run Version"
3. Daily before work: all code before update

Use environment

To use SVN to manage your source code, you have to have 2 sets of environments

Server
1. The source code used to store client uploads
2. You can install Visual SVN Server on Windows
3. In most cases, the company's developers do not have to build the SVN server themselves

Client
1. Upload the local source code to the server, or update the server to local, keep synchronization
2. You can use the command line, Versions, Cornerstone, Xcode on Mac
The developer belongs to the client, the role

1.Visual SVN Server:
http://www.visualsvn.com/server/download/

2.Visual SVN Server Installation:

3. Create a code Warehouse

4. Add Users

5. Set permissions

6. Web Access server

SVN client command
    • SVN checkout: Download the server's code to local (abbreviated SVN CO)
    • SVN commit: Commit the changed file to the server (svn ci)
    • SVN update: Updating the server's code to local (abbreviated SVN up)
    • SVN add: Adding a new file to the local version control library
    • SVN Delete, svn remove: Delete files from the local version control library (SVN del, SVN rm)
    • SVN move: Move file or directory or file rename
    • SVN mkdir: Create a new directory under version control
    • SVN revert: Undo all previous Changes
    • SVN Merge: Merge the differences between the two versions into the current file

    • SVN info: View the details of a file

    • SVN diff: See the difference between different versions
    • SVN log: View log information
    • SVN list: List of files and directories under repository
    • SVN Status: View file status (abbreviated SVN ST)
    • SVN help: Get assistance information (e.g., SVN assist CI)
    • SVN Lock: Add lock
    • SVN unlock: Unlocking
Check out

Check out (download) a project to a local

    1. SVN checkout URL [PATH]
    2. SVN co URL [PATH]

Note: the brackets [] here represent optional (can be omitted)

Example
svn checkout https://192.168.1.106/svn/Weibo/
/users/documents/workspace

    1. Blue represents: The remote address of the Code warehouse
    2. The orange represents: which path to download the code to local

If you omit the orange path, download to the path where the command line is currently located

Submit

Submit the changed files to the server

    1. SVN commit-m "Notes" [PATH]
    2. SVN ci-m "Notes" [PATH]

Note: Be sure to develop a good habit of writing notes

Example
SVN commit-m "modified USER.M file"
/users/desktop/workspace/weibo/branches/user.m
Orange stands for: which file is submitted to the server
If you omit the orange path, submit all the changed files in the path of the command line to the server

Add to

Submitting a new file to the server requires 2 steps

    1. Add the newly created file to the local version control repository: SVN add
    2. Submit the Add action to server: SVN commit

If you submit a file that is not added to the local version control library, the following error is reported
is not a working copy

add a new file to the local version control library
SVN add PATH

Example
SVN add/users/desktop/workspace/weibo/branches/user.m
Orange stands for: which file is added to the version control Library

Delete

To delete a file on a server, you need to do 2 steps

    1. Remove files from the local version Control library: SVN Delete, svn remove
    2. Commit the delete operation to the server: SVN commit

To remove a file from a local version control library
SVN Delete PATH

Example
SVN delete/users/desktop/workspace/weibo/branches/user.m
Orange stands for: which file to remove from the version control Library

Update

Update the server's latest code to local
SVN update [PATH]

Example
SVN update/users/lnj/desktop/workspace/weibo/branches/user.m
Orange stands for: Update the contents of which file
If you omit the orange path, update all the contents of the path where the command line is located

Restore a file to a version
SVN update-r version number [PATH]

FAQ Summary

1. Go to the company's first day, download the company's code to the computer
SVN checkout

2. Modify a legacy file that already exists and submit it to the server
SVN commit

3. Submit a new file of your own to the server
SVN Add, SVN commit

4. Delete a legacy file that is already existing and sync to the server
SVN Delete, SVN commit

5. Update the new code submitted by other colleagues to your computer
SVN update

6. Accidentally write a lot of things wrong, want to undo the written things (have not yet submitted the changes to the server)
svn revert

7. Accidentally deleted the wrong file, want to restore the file back (have not been submitted to the server)
svn revert

8. Accidentally write a lot of things wrong, want to undo the written things (has already submitted the changes to the server)
SVN update-r version number

9. Accidentally deleted the wrong file, want to restore the file back (deleted to the server has been submitted)
SVN update-r version number

Note
. SVN this hidden directory records very critical information
Do not manually modify or delete this. SVN hidden directory and the files inside! Doing so will cause the local working copy to be corrupted and cannot be manipulated.

Graphical interface Tools

On Mac, you can also use the SVN graphical interface tool to manage source code, which can greatly reduce the pain of using the command line (some operations are cumbersome to use command lines, such as conflict resolution)
Cornerstone/versions/xcode

Most of the work can be done in Xcode
Xcode support for SVN is not very friendly, especially when creating a new folder that is prone to problems in Xcode

Work with Xcode: Update first, then submit!
Xcode, it's best not to modify a storyboard! at the same time.

Cornerstone adding a management warehouse

XCODE5-SVN Configuration
1. Add SVN address
2. Xcode 6 is in Xcode > Preferences > Accounts > Repositories (menu to the left) > (+) Add Repository

XCODE5-SVN configuration-Add SVN address

XCODE5-SVN configuration-Set SVN account

xcode5-Download Server code

Catalog specification

The SVN directory structure of a regular project typically has 3 folders

Trunk: Trunk, home directory of the current development project
Branches: Branch directory, which is used when non-mainline features are added, can be merged into a skeleton project after development testing
Tags: tags directory, usually as a major version of the backup

SVN directory Use-case

    1. A team plans to develop a "Mo Mo" project
    2. Part of the base code is already in the early stages of this project
    3. Research and development team in this basic code after 3 months of effort, developed a relatively complete V1.0 version of the launch promotion, and achieved good results (backup to tags)
    4. As the market feedback was good, the team began to work on the development of the V2.0 version
    5. In the development of the V2.0 version, it is found that there is a serious bug in the V1.0 version, which will cause serious consequences if not modified in time.
    6. After the development team receives the bug report, it immediately arranges for the V1.0 version to be repaired, but other developers continue to develop the new features of the V2.0 version
    7. The person who fixed the bug quickly found the cause of the problem and fixed the problem, and released the V1.1 version for the user to upgrade, so there was no significant loss
    8. After a bug fix, the developer integrates the repaired code into the development line so that it does not occur again in subsequent releases later on
      In this way, the whole team in the joint efforts of everyone, methodically carried out ...

Create a Momo code warehouse

Using SVN we should

    1. Frequent updates: reducing the likelihood of conflict
    2. Before committing to a native test pass: Reduce the issue code to the repository
    3. Be sure to write notes when you submit (note): Convenient for other employees to view and review them later
    4. Do not submit to the repository for files that do not need to be submitted

Tips

    1. It is best to update it before each modification
    2. Code that runs through the day before work day
    3. The first thing that goes to work every day updates the code

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Source Code Control Tool SVN

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.