How to use SVN under Android Studio (1)-First knowledge of SVN

Source: Internet
Author: User
Tags svn client

How to use SVN under Android Studio (1)-Introduction to First-knowledge SVN

These days the company has come new, before all a person developed projects now need to co-development. Therefore, it is unavoidable to use version control tools.

The company is using SVN, there are a lot of tutorials on the internet, but found that for beginners, especially those who have never contacted, often said is not very detailed, and can even say that basically did not take care of these aspects. Don't ask me why I am so clear, because the pit is not ...

PS: This article is to introduce the use of the as under SVN, so may be different from the online tutorial

Use Download and install

First go to the official website to download the SVN client, the official Web download may be slow, here is a good installation package

  • Tortoisesvn_1.9.4.27285_x64

This is the SVN client, there is also a service side, but the general development and development of the use of the client is sufficient, the server is to provide a boss and or the director of the use of

Install directly after the download is OK, the installation directory is arbitrary, but the directory can not contain the Chinese path

Configuration

Generally in the company's use of the company will give you a user name password, the submission will show your user name, so that you can clearly know who submitted the code led to the entire project collapsed, booming trance ~ ~ ~

In case the account password forget also does not matter, to find your boss or team leader to go, but may be scolded 、、、

The following highlights the configuration under as

First add SVN's boot path in as, Use Command line client select svn.exe file under Set path

If there is no svn.exein this path, then it is possible to omit a plugin when installing
For example, you can select the middle one Crash Reporter .

After the boot configuration is complete, the configuration ignores the file, because the as version or the Gradle version may cause the need to configure or upgrade each time, so some files are not required to be submitted, such as

Click on the upper right corner to add the Ignore file, the default entry to the project root directory

Ignore the file altogether three parts, the following describes

  1. Ignored files added by default system
  2. Files or directories that are added manually, usually as items should be ignored
  3. Manually added, if the project needs to ignore other, such as compiling the project as a dependency need to ignore

How do I add?

In turn, the

    • Files that are ignored
    • Ignored directories
    • Matches according to syntax, such as *.iml means ignoring all files with the suffix iml
associating with remote warehouses

Here are two ways to choose, directly import and associate the project , here is the second one, the direct import may have some strange problems

Click to Share Project pop up the following window

The above is to select the warehouse address, the first time you may need to add, the following is the selection of the target path, because there may be branches in the warehouse and other multi-level directory

After the selection is completed, you will be prompted to mention that the warehouse is not empty, not the first time the warehouse is empty, OK

The code will be checked at the time of submission, it is recommended to choose Version 1.8 , and the other two will have some strange problems.

After selection, you will be prompted to create an association and wait for it to complete

After the association is successful, the toolbar will have two more icons indicating the submission and update

commit (Commit changes)

Usually automatically submitted after automatic Update check, the left is the list of files to submit, you can choose which files to submit, the left is the submission of information, for a brief description of the submission of the content, the proposal at the time of submission of the best to write the submission, so when the error is also timely positioning

Then click Commit , then code check, if the code is not wrong to confirm the commit, the warning can usually be ignored

Updates (update)

There are two choices when updating, usually choose the second one, the default version is the HEAD version that represents the update of the current warehouse; the first option is used if you have a branch in your project, and you can choose to update different branches.

Here's a little bit of a rollback of one of the most important features of version control, and you can choose to update the historical version. Click on HEAD The three point on the right

  1. The version number that is submitted, usually a version number is automatically added to each commit, sorted
  2. Submitted by the user, i.e. who submitted the code
  3. Time of submission
  4. Submit Information
Note

If you follow the above steps you can successfully associate the project with SVN, but only if the warehouse is empty , that is, the first time you use it. If you're not using it for the first time or if you're part of a team, you'll find the problem, and SVN is a downloadable download, and you're sure to say, "I can download it directly", but there's a problem, how do i download it? Where to download? because the download is required in the context of the relevant premise , if you create a new project, you must register the path, and if it is new SVN download will be in your current project alone in the new folder to store your warehouse files, rather than directly cover the root, And there's a problem with that approach.

Don't worry, SVN has already thought of this for us, is actually downloading, but will be all the above functions to help you finish

Checkout function

Checkout this feature is particularly convenient, only with the selection of the corresponding version control tool, and enter the corresponding project address, as can be fully automated to help us to download the project, and automatically add the ignored file directly import

Then select Checkout to

PS: Previously did not know this function, can only directly copy the project at the same time, and then import all kinds of problems. Because the project file upload in the warehouse added ignore files, which leads to a more embarrassing problem, ignore the file, and create a new empty project to ensure the same package name ... I'm not going to tell you the process.

problems encountered

Before you make a payment because the problem with the jar package causes the project to fail to run, it can run after the rollback, but updating the latest version directly does not work. This creates a very embarrassing problem, if the submission is only to add new content, and will not overwrite the historical content, so can only be re-read, the warehouse in the whole thing deleted, re-submitted again. The only way I can think of it now is that some places don't understand.

Tail

The beginning of the project because of the problem of updating the tutorial, get an afternoon! Finally, it is not feasible to download a new project directly, only the associated items can be imported. Because no one is pointing, so it is tears, why the more simple problems are ignored, it may be because the great God thought too simple, reason why should know

The above is a personal opinion, because it is the first contact so only understand the basic usage, if there is wrong place also please correct, but in this article, for the general project is enough, if the project is large, there are some advanced usage

The next article updates the code conflict and how to resolve the problem

Appendix

Code Color Introduction

  • Green: New File
  • Blue: Changed files
  • Red: Conflicting files
  • Yellow: Ignore File
  • White: Normal file, indicating conflict resolution or post-commit files

How to use SVN under Android Studio (1)-First knowledge of 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.