iOS development-About code management tools SVN

Source: Internet
Author: User

Recently in a project, using the Code management tools, then a simple understanding of the SCN, namely the principle and some common commands.

So why do we need to use SVN, we can? SVN as a backup server, he can help you remember each upload to this server file content, and automatically assigned to a version of each change.

Because if it is a team development, versioning is very important, you cannot guarantee that the version you have on hand is always right, for team development, data synchronization is very important, because each one needs their own data, so SVN can help you solve this problem.

  1. Overview


SVN is a centralized source-code management tool

Concept:
1> Repository Code warehouse, store code repository
2> Server server, save all versions of the Code warehouse
3> client clients, save only the current user's Code warehouse
4> User name & password access code warehouse needs to use its own "User name and password", so that different people can distinguish the code changes

Operation:
1> Checkout Download the latest code warehouse on the server to local, "only need to do once"
2> Update Downloads Other people's changes from the server to local, "What you have to do every day"
3> commit commits the work to the server, "do it at least once a day before work"

Common commands:

# Switch Working directory
$ CD Manager's working directory
# Checkout the code warehouse on the server
$ svn Co Http://10.0.1.15/svn/weibo--username manager--password Jingli

Tip: After Checkout (CO), the user name and password are recorded in the local code base, and subsequent operations are not specified separately

02. Manager Add File
================================================================================

* SVN common commands
--------------------------------------------------------------------------------
# view local code base status
$ SVN St
Error: "Is not a working copy", must be in SVN's working directory in order to correctly use the SVN command
# View SVN logs
$ svn Log
# View a log of a file
$ svn log filename
# View a log of one version of a file
$ svn log [email protected]

* Create a file
--------------------------------------------------------------------------------
# Switch to working directory
$ cd Weibo
# Create a file
$ Touch MAIN.C
# Open and Write file contents
$ open MAIN.C

* Submit the file to the server
--------------------------------------------------------------------------------
# View working directory Status
$ SVN St
# Add files to the local repository
$ svn Add main.c
# submit the file to the server's repository
$ svn ci-m "added Main.c file"

"Summary"-two steps to add a file
--------------------------------------------------------------------------------
1> Adding a new file to the local code base
$ svn Add main.c
2> submit the file you just added to the server
$ SVN ci-m "Memo Info"

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

03. Team members Join
================================================================================

1> Zhang San
$ svn Co Http://10.0.1.15/svn/weibo--username=zhangsan--password=zhang
2> John Doe
$ svn Co Http://10.0.1.15/svn/weibo--username=lisi--password=li

"Summary" So far, the construction of a project is over.
1> project preparation, usually done by project manager
2> programmers only need to bring the project co locally

Tip: Don't forget to ask your manager to assign SVN's account and password when you enter a new company

04. Zhang San Add files
================================================================================

# Add File Person.h person.m
$ Touch Person.h person.m
# Modify Person.h person.m
$ open Person.h
$ open PERSON.M
# Add Person.h person.m to the local code base
$ svn Add person.*
# Submit content to the server
$ svn ci-m "added Person class"

05. deleting files
================================================================================

# Delete Files
$ SVN rm Person.h
# Commit Delete
$ svn ci-m "deleted Files"

Note: Do not use File Manager to delete files directly

06. Undo Changes
================================================================================
$ svn revert person.m

07. Revert to a previous version
================================================================================
$ svn up

08. Conflict resolution
(p) Postpone contrast
(MC) Mine-conflict Use my
(TC) Theirs-conflict use each other's

The file status displayed:

1th Column Status Description: Description file is added, deleted, or other modified
--------------------------------------------------------------------------------
"No Modification
' A ' is added to the local code repository
' C ' conflict
' D ' was deleted
' I ' is ignored
' M ' was modified
' R ' is replaced
' X ' external definition of the created version directory
'? ' file is not added to the local repository
'! ' file is missing or incomplete (not files deleted by SVN command)
' ~ ' controlled file blocked by other files

2. Introduction of Tools
1. Download the cornerstone,:http://www.cr173.com/mac/121625.html first, and then open the operation after downloading:The first step2. For SVN configuration:SVN configuration3.HTTP configuration:HTTP Configuration? 4. How to upload a local file:Step Two5. When the information is completed, it will appear as shown:Step three6. Import Local Files:Fourth Step7. Then select the project file you want to import, and import it, such as:Fifth Step8. After importing, select Project, click Checkout Export Project, for example:Sixth Step9. After exporting, you can perform operations within the exported project, such as:Seventh Step10. Each time you upload the code, you need to update, if there is a conflict, resolve the conflict, and then commit to the SVN above, you need to fill in the change log, such as:Eighth Step11. The final submission of the update is good, so that the code you changed to the SVN management tool, so that the project when the team members can only change in the SVN to update the current version of the latest.

3. Summary:

* Benefits of using source code control tools:
# can track a project from birth to final process
# Record all content changes for an item
# easy access to specific revisions

* If it is team development, using the source Control tool is mandatory!
* If you are a single developer, it is also highly recommended that you start using source control tools now

* Using Source Control tools
# no increase in workload due to ease of use
# does not cause any damage to existing work (bad effect)
# is a technology that a qualified software developer must master

iOS development-About code management tools 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.