Source code control tools SVN and Git

Source: Internet
Author: User
Tags svn client svn update

The reason for the birth of source code management tools:

1. Can't regret: After doing a wrong operation, there is no regret medicine can eat;

Note: When programming with Xcode, we made a code change, suddenly Xcode collapsed, or accidentally turned off. Then the good code written just now lost, even if the command+z can not back

2. Version backup: Fee space, fee time;

If we want to prevent the completion of a module or a function of the code after Xcode because of accidentally shut down and lost code, to do a version backup, then write a project, not a backup of hundreds of copies? Time Consuming space!

3. Version confusion: Because the version backup too much confusion, it is difficult to retrieve the correct version of the desired;

Too much backup will make it impossible for you to find out what code you wrote before.

4. Code conflicts: Multiple people operate the same file (common problems in team development); We develop in the company, most of the cases are developed by many people. So the company's Zhang San and John Doe all have the same code, then they may modify the same line of work code, that question, the two lines of code in the end is the use of Zhang San? Or is it John Doe? 5. Permission control: The source code can not be accurate control of permissions; A new colleague to our company development, then he no matter 3,721, the code to the pulp, and then leave. So.... This app will no longer run! Wasted time, money, cost! 6. Accountability: There has been a serious bug, unable to know who did it, easy to cheat; A code error, who should be held accountable? The advantages of the use of the source code tools: 1. Record each code operation of the project (additions and deletions); 2. Infinite Regret (code can be kept back); 3. You can see the code changes at every moment; c. Common source code management tools 1. SVN (company development Common, centralized) 2. Git (commonly used abroad, personal development Common, distributed) (in order to prevent the leakage of code, in the domestic less) four, how to use the day before work: Commit "run Version" code; (upload) before work every day: the code before the update, (download) checkout only need to do once! Five, the use of the environment to use SVN to manage the source code, there must be 2 sets of environment 1. Server to store 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 SVN servers themselves 2. The client uploads the local source code to the server, or updates the server's codes locally, keeping the synchronization available on the Mac using the command line, Versions, cornerstone developers belong to the role of the client visual SVN serverhttp://www.visualsvn.com/server/download/ svn client command svn checkout: Download the server's code to the local (abbreviated SVN CO) SVN commit : Submit the changed file to the server (abbreviated SVN ci) SVN update: Update the server's code to local (abbreviated SVN up) SVN add: Add new files to the local version control Library SVN Delete, svn remove : Delete files from local version Control library (abbreviated 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 everything before you modify the SVN merge : Merge differences between two versions into the current file SVN info: View the details of a fileInformation svn diff: See Different versions of the difference SVN log: View log information svn list: List files and directory listings under the Repository SVN status: View file status (abbreviated SVN st) SVN help: Get assistance information (e.g. SVN assist CI) svn Lock: Locking svn unlock: Unlock checkout   Check out item (download) to local  SVN checkoutURL[PATH] SVN CoURL[PATH]

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

Example

SVN checkout https://192.168.1.106/svn/Weibo/,

/users/lnj/documents/workspace

Blue represents: The remote address of the Code warehouse red represents: Which path to download the code to local if the red path is omitted, the download to the command line is currently located in the path to submit the modified file submitted to the server SVN commit-m "comment"[PATH]SVN ci-m "Comments"[PATH]

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

Example

SVN commit-m "modified user.m file" /users/lnj/desktop/workspace/weibo/branches/user.m

Red represents: Submit which file to the server if the red path is omitted, the command line is located in the path of all the changed files to the server to submit a new file to the server, 2 steps to add the new file to the local version control library:SVN addSubmit the Add action to the server just now:SVN commit

If you submit a file that has not been added to the local version control library, the following error is reported. Working copy adds a new file to the local version control repository SVN addPATH

Example

SVN add /users/lnj/desktop/workspace/weibo/branches/user.m

Orange represents: Add a file to the version control library to delete a file on the server, you need to do 2 steps to remove the file from the local version control library:SVN Delete, svn removeCommit the delete operation to the server just now:SVN commit

Remove the SVN delete PATH from the local version control library

Example

SVN delete /users/lnj/desktop/workspace/weibo/branches/user.m

Red represents: Which file is removed from the Version Control Library FAQ Summary Go to the company's first day, download the company's code to the computer SVN checkout modified a long-existing old file, and then submit to the server SVN commit to submit a new file to the server SVN add ÀSVN Commit n Delete an old file that already exists, then sync to the server SVN deleteàsvn commit to update the new code submitted by other colleagues to your computer SVN update accidentally wrote a lot of things and wanted to undo what was written (the changes have not yet been submitted to the service svn revert accidentally deleted the wrong file, want to restore the file back (have not submitted the deletion to the server) SVN revert accidentally wrote a lot of things wrong, want to undo the written things (have to submit the changes to the server) SVN update-r version number accidentally deleted the wrong file, want to recover the file Back (have deleted commit to server) SVN update-r version number note. SVN This hidden directory records very critical information never manually modify or delete this. svn hidden directories and files inside! Doing so will cause the local working copy to be corrupted and cannot be manipulated (and Xcode's merged article remains to be continued)

Source code control tools SVN and Git

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.