How to use SVN on Eclipse, install, commit, pull code, resolve conflicts, etc.

Integrate SVN into Eclpise

the first method

The first method is to install it in Eclipse through a zip file (this plugin is suitable for versions below Eclipse 4.5, 4.6 is not verified. It cannot be used on 4.7 )

svn plugin (Chinese version) download address: click to open the link
Find Help on the far right in the menu bar and select Install New Software

:

 

Select the plugin location, click Add first, and select the location of the SVN plugin in the pop-up window

 

Select the local SVN plug-in compressed package, click to open

Select the content that will be integrated and tick it all



After loading, the following interface will appear, continue to click Next (the last option can be omitted, remove the tick, Contact.....)

Accept the agreement and click Finish

There may be a security warning while waiting for the plugin to install, click OK to continue the installation


After the installation is complete, there will be a prompt to restart Eclipse, click YES

 

 

 

After restarting, click Window→Show View→Other

 

If you can see the SVN folder branch in the Show View window, it means the installation is successful (enter svn in the text input box to filter the information)

 

 

The second method

To avoid unnecessary problems , first make sure our Eclipse is closed !

Unzip our installer

 

Copy and paste the pressurized features and plugins folders to the root directory of Eclipse (also has the root directory of features and plugins files)

View us Window→Show View→Other

 

Enter svn in the text input box to filter, see our SVN folder, and click OK to appear in the Tab area, it means success

 

 The third method (online installation, only English version)

 Online installation Open Eclipse, go to Help-Eclipse Marketplace and search for Subversive (applicable to all Eclipse versions)

The use of SVN in Eclipse

 

Commit the project to the SVN server

Right-click the project and select Team→Share Project

 

 

Choose to share in SVN

You can choose to create a repository or choose to use an existing one, we now choose to create a new repository

Paste our repository path in and click Next

 

 

You can choose to use the project name as the folder name in the resource library, click Finish to end

 

 

After selecting the project to be shared to the SVN server, we need to select the ignore file

Right-click the project we just shared to the server, select Team→Set Properties

 

 

 

Now select "svn:ignore" in the drop-down selection box of the property name, and then enter the following text in the large box of "Property Content"

These files are automatically generated when our project is compiled, and ignore is added to avoid conflicts

target

.project

.classpath

.settings

gen

bin

 

After setting the ignore file, we can start to submit, right click on the project managed by SVN, select Team→Submit

 

 

In the opened interface, we enter the description of the update in the upper part, and determine the file to be updated in the lower part. We can see that the ignored files and folders we just added will not be submitted to the server, and the confirmation is completed. Then click OK

 

 

After the submission is complete, we can see that our gen and bin folders do not have the logo to be submitted to the server at the bottom right, and then look at our SVN server, and we can also see that the file is already there, which means that we have submitted the project to SVN.

 

 

 

Pull the project from the SVN server to Eclipse

First, we need to display the SVN repository tab, open the menu bar Window→Show View→Other

Enter svn in the text input box of the pop-up window, select the SVN repository under the SVN directory, and click OK

 

You can see that the SVN repository branch window has been added to the bottom window

Right-click in an empty location and select New→Library Location

 

 


Enter our repository location in the pop-up window and click Finish

 

 

This will see our repository location added to Eclipse's SVN repository tab

 

Right click on the project we just checked out and click "Check Out As" (the previous project needs to be deleted first)

 

Select the first item "Check out as a new project"

 

In the pop-up window, select the type of our project, here our project is an Android project, select the Android application project

 

Then configure the properties of the project, if there are no other requirements, all the way to the next step

 

Waiting for the project to be pulled from the server, then we successfully pulled a project from the server to the local

 

 

Update code to server in Eclipse

If we make changes in the code, then in the directory structure shown on the left, the changed files and folders will have an additional * in the lower right corner, which means that they will be updated


 

 

Select the project we want to update, right click on the project → Team → Submit


In the submission view, we can fill in the update operation, and we can see our updated file, click OK to complete


resolve file conflicts item is out of date

What should we do if the prompt item is out of date appears when we submit the code?

 

We right-click our project and update it once, and we will find that there are other copies of our conflicting files, and the code will also display other content

We select our conflicting file and start editing the conflict

 

In the above panel, we select the wrong place, we will set it to be reduced, and then change our conflicting code

 

After making changes, press Ctrl+S to save, and when you go back to our previous code file, you will find that the extra content has disappeared.

 

 

Go back to the file we just edited, right-click and select the mark bit to solve

 

We select the first option and press OK

 

Then we found that the extra copies had disappeared, and the lower right corner of the previously conflicting files had also changed to * to indicate that they could be updated

try submitting again

 

This time you can see in the Console menu bar that we have successfully submitted


 

The above is the common operation of SVN in Eclipse

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325940668&siteId=291194637