Source Control Tool SVN is a very powerful source control tool, now domestic 70%-90% companies are using SVN to manage the source code, let's give you a small part to focus on the use of SVN, SVN's use is mainly divided into the following blocks.
- SVN's usage environment
- Server-side configuration
- Use of client software
- The use of client-side graphical interface tools
- SVN's directory specification and usage examples
1.SVN usage environment.
To use SVN to manage your source code, you have to have two sets of environments
- can be used to store the source code for client uploads
- You can install Visual SVN Server on Windows
- In most cases, the company's developers do not have to build the SVN server, basically you enter the company after the company will have the SVN server address and your user name and password to tell you, of course, if he is not at ease with you, he may visit you for a few days before deciding whether to give you.
- Upload local source code to the server, or update the server to local, keep synchronization
- You can use the command line, Versions, cornerstone-graphical operating software on your Mac, Xcode
- The developer belongs to the client, the role
2. Server-side configuration
Server side installs Visual SVN server-http://www.visualsvn.com/server/download/on window pc
- Install Visual SVN Server
- Create a code Warehouse
- Click on the first yellow folder on the left, then click New, enter a name, next, so that an empty warehouse is created.
- Click the second yellow folder on the left, right-click, create a new user, and set the user name and password. Click OK to submit when you are finished setting up.
- Click on the repository you created, right-click, and select the Properties option.
- Click on properties to come up with an interface, select the user you just created, then click Add.
- Access the warehouse address.
- Select the repository you created, then right-click on the copy URL and click on it to get the repository URL in our clipboard.
- Open your computer's browser, enter the URL you just received, and then you need to enter a user name and password, you can enter the warehouse after entering.
Configuration of the 3.SVN client
SVN checkout https://192.168.1.106/svn/Weibo//users/documents/workspace
HTTPS://192.168.1.106 represents: The remote address of the code warehouse-this is the IP address of the computer you just
/svn/weibo//users/documents/workspace stands for: which path to download the code to local
- 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
- SVN commit-m "Notes" [PATH]
- 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 in Lis not a working copy
- 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
- Remove the SVN delete PATH from the local version control library
- Update the server's latest code to the local SVN update [PATH] Sample
SVN update [File path to update]
n Restore the file to a version of SVN update-r version number [PATH]
4. Graphical interface Tools
- On Mac, you can also use the SVN graphical interface tool to manage your source code, which can greatly reduce the pain of using the command line (some operations are cumbersome with command lines, such as conflict resolution) Cornerstone/versions/xcode most of the work in Xcode can be done
- 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.
- Download Cornerstone Add Management warehouse in Mac
5. 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
6. Summary of Frequently Asked questions
- Go to the company's first day, download the company's code to the computer on SVN checkout
- Modified an old file that already existed and then submitted it to the server SVN commit
- Submit a new file of your own to the server
- SVN addàsvn Commit
- Delete an old file that already exists, and then sync to the server SVN deleteàsvn commit
- Update new code submitted by other colleagues to your computer SVN update
- Accidentally write a lot of things wrong, want to undo the written things (have not yet submitted the changes to the server) SVN revert
- Accidentally deleted the wrong file, want to restore the file back (not yet deleted to the server) SVN revert
- Accidentally write a lot of things wrong, want to undo the written things (have changed to submit to the server) SVN update-r version number
- Accidentally deleted the wrong file, want to restore the file back (has deleted to submit to the server) SVN update-r version number
- SVN this hidden directory records very critical information never manually modify or delete this. svn hidden directory and files inside! Doing so will cause the local working copy to be corrupted and cannot be manipulated.
7. 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
- 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
Source Code Control Tool SVN