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
Check out
Check out (download) a project to a local
- SVN checkout URL [PATH]
- 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
- Blue represents: The remote address of the Code warehouse
- 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
- SVN commit-m "Notes" [PATH]
- 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
- Add the newly created file to the local version control repository: SVN add
- 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
- Remove files from the local version Control library: SVN Delete, svn remove
- 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
- A team plans to develop a "Mo Mo" project
- Part of the base code is already in the early stages of this project
- 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)
- As the market feedback was good, the team began to work on the development of the V2.0 version
- 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.
- 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
- 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
- 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
- Frequent updates: reducing the likelihood of conflict
- Before committing to a native test pass: Reduce the issue code to the repository
- Be sure to write notes when you submit (note): Convenient for other employees to view and review them later
- Do not submit to the repository for files that do not need to be submitted
Tips
- It is best to update it before each modification
- Code that runs through the day before work day
- 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