Introduction to version control under IntelliJ idea

Source: Internet
Author: User
Tags svn client git client version control system tortoisesvn

Whether it's personal development or team development, versioning is good to use, and I can't find any reason why developers don't use version control at the moment. And for the IDE, integrated versioning itself is one of its biggest highlights, and many developers use it for this.

The related versioning of IntelliJ idea is also described in this section and will begin to relate to some of the IntelliJ idea humanization settings, and hopefully you will begin to recognize the elegance of IntelliJ.

A lot of people think that IntelliJ idea comes with a version control tool like SVN or Git, and thinks that with the installation of IntelliJ, you can fully use the functionality of version control. This is a completely wrong interpretation, IntelliJ idea is to bring the support plug-in for these versioning tools, but what version control client to install is still installed.

As shown in callout 1, IntelliJ Idea's support for versioning is implemented in a plug-in fashion. The flagship version supports the current mainstream versioning software by default: CVS, Subversion (SVN), Git, ClearCase, Mercurial, Perforce, TFS. And because so many people now use GitHub for collaboration or project versioning, IntelliJ idea comes with a github plugin that makes it easy to Checkout and manage your GitHub projects.

Configuration of SVN

To use SVN in IntelliJ idea, you need to install the SVN client or TortoiseSVN, a graphical tool like this, and the Windows system is recommended to install TortoiseSVN, even if you don't use IntelliJ idea to manage our items. Accounts

The main versions of SVN are 1.6, 1.7, 1.8, and the latest is 1.9. We recommend that you use 1.8. If your project is using a 1.6 version, you can upgrade the project file directly after installing 1.8, so there is no need to worry about it, so it is recommended that you use 1.8.

Subversion website Download: https://subversion.apache.org/download/#recommended-release

TortoiseSVN official website Download: http://tortoisesvn.net/downloads.zh.html

As shown in the arrows, when installing the TortoiseSVN, the default command line client tools is not installed, it is recommended to check the box.

As shown in callout 1, tickUse command line client

As shown in callout 2, it is recommended that the SVN path itself be selected according to the installed path, or sometimes IntelliJ idea does not recognize the report: such Cannot run program "svn" errors.

As shown in callout 3, when using SVN for a period of time, find that a variety of SVN related problems can not be resolved, you may consider clicking this button to clear the cache.

According to the current experience of use, IntelliJ idea under the SVN experience is not pleasant, at least more than Git a lot of bad, often encounter a lot of problems, so here is also a first to remind you. If IntelliJ idea cannot be updated and submitted in an emergency, remember to use TortoiseSVN to manipulate it.

Configuration of Git

To use Git in IntelliJ idea, you need to install the Git client first, which is recommended to install the official website version.

The main version of Git is 1.X, 2.X, the latest is 2.X, use the version at will, but not too new, or may IntelliJ idea of the old version will not be able to support the possibility.

Git website Download: http://git-scm.com/

Tortoisegit official website Download: http://download.tortoisegit.org/tgit/

As shown in callout 1, determine if there is a corresponding executable file under the path.

Github Configuration and usage

As shown in callout 1, fill in your Github login ID and password, click Test to test whether it can be connected correctly.

As shown in callout 1, the Checkout project is supported directly from the Github account you are currently logged into.

As shown in callout 1, support to share the current local project on your Github account.

As shown in callout 1, support creation Gist . Github's Gist website address: https://gist.github.com/

Version Control main action button

As shown in callout 1, the menu option for right-clicking the catalog is displayed.

As shown in callout 1, the right-click popup menu option for the file.

As shown in the red circle, for the version Control action button on the toolbar, basically everyone is also used here to operate.

First button: Update Project updates the item.

Second button: Commit changes submit all the changes on the project file. Click this button will not immediately submit all the files, but the first to pop up a modified file a summary box, the specific operation below will be a special description of the picture.

Third button: The Compare with the Same Repository Version current file is compared to the contents of the file-through version on the server. If the currently edited file is not modified, it is grayed out and not clickable.

Fourth button: Show history Displays the history of the current file.

Fifth button: Revert restores the currently modified file to a version that violates the modification. If the currently edited file is not modified, it is grayed out and not clickable.

As shown in callout 1, the version Control Action area on the menu bar.

Version control-related common settings instructions

As shown in callout 1, the version control used by the current project is Git . If you do not want this project to continue using version control you can click the minus button next to it, if you want to switch version control, you can click on the Git various version control selection lists that will appear IntelliJ idea support, but we generally do not have more than one version control for a project.

As shown in callout 2, Show directories with changed descendants indicating that a subdirectory has a file modified, all the upper directories of the file display the color of the version control concept. The default is unchecked, I generally recommend checking this feature.

As shown in callout 1, When files are created This means that when a new file is put into the project, IntelliJ idea does what it does, and the default is to Show options before adding to version control indicate the pop-up prompt option to let the developer decide whether the new files will be added to version control or not. If you do not want to eject the prompt, select the following two options to do the default action.

As shown in callout 2, When files are deleted This means that when a new file is deleted in the project, IntelliJ idea does what it does, and the default is to Show options before removing from version control indicate the pop-up prompt option, which allows the developer to decide whether the deletion is removed from version control. If you do not want to eject the prompt, select the following two options to do the default action.

As shown in callout 1, for files that you do not want to add to version control, you can add the list that you want to ignore. However, if this feature is used in a file that has been added to a version control, it means that the file or directory can no longer use versioning-related operations, such as commits, updates, and so on. My personal use of the process found that this feature is not very useful on SVN, Git can be used.

The pop-up layer shown above is the change file summary pop-up that pops up after clicking on the Commit changes in this article.
As shown in callout 1, you can right-click on a file.
The Show diff current file is compared to the contents of the file version on the server.
Move to another changelist transfers the selected files to the other change list. The change list is an important concept that needs to be highlighted here. Many times, we develop a project and concurrent tasks may be many, each task involved in the file may be based on the business perspective. So there will be a situation like this: I changed 30 files, 15 of which is the order problem, and the remaining 15 is the membership issue, I would like to submit the code is based on the business to differentiate these files, so I fill in a Commit Message is a good description, and in the case of many files, I am also good at distinguishing between these file business modules to be submitted. So I usually transfer the 15 files that belong to the order to the other change list, focus on the 15 member issues of the file, first submit the membership issue of the change list, and then submit the order member's change list. One of my personal uses is to transfer files that are not submitted temporarily to a change list that I specify, and so on, I think it is necessary to commit, and then commit, so that these files will not interfere with my current modified file submission. The function of the change list is summed up so that you can better manage your version control files so that your focus points are better focused and thus provide efficiency.
Jump to Source opens and jumps to selected.
As shown in callout 2, you can operate according to the toolbar button, the action of the object will be the mouse selected files, multiple selection can be pressed Ctrl, you need to note that the more previous check box is not much of a relationship.
As shown in callout 3, you can automatically perform some action events on the submitted file before committing it (the project uses Git, which may have some buttons with different versions.) ):
Reformat code formatting codes, if the WEB development is not recommended to check, because the format of the JSP class file, formatting effect is not good. If they are all Java classes, they can be formatted with peace of mind.
Rearrange code re-orchestration, IntelliJ idea supports a variety of complex orchestration settings options, which will be said later. Once you've set up the encoding function, you can try checking this for automatic orchestration.
The Optimize imports optimized import package will automatically remove unused packages. This recommendation is checked, and this only works for Java classes, so don't worry about side effects.
Perform code Analysis, which does not need to be dealt with at the time of submission, but is developed in order to develop a habit of analyzing the code. IntelliJ idea integrates the code analysis functionality.
Check todo checks for Todo in code. The TODO feature will also be followed by chapters, which are briefly described here: this is a function of recording to-dos.
Cleanup clear the Version control system, remove some version control system error messages, recommended check.
Fill in the submitted information as shown in callout 4.
As shown in callout 5, the change list changes the listing, which is a drop-down option that shows that we can switch between different change lists and submit a different changed list file.
As indicated by the callout arrows, we can view the commit message used in our commit history, sometimes we do the same task, but we need to submit it several times, and in order to better manage the project, it is suggested that the message submitted is consistent.

As indicated by the callout arrows, if you are using Git, click this location to switch branches and create branches, as well as merge, delete branches, and so on.

Use of SVN

SVN This window some IntelliJ idea on the call Changes , some called Version Control , specifically what causes such differences, I am not clear. But no matter how the structure is the same, so the user does not have much impact, but you need to know that they are actually the same function.

Local ChangesThis Tab represents a preview of the overall situation of each file in the SVN of the current project. Here Default is the default change list name of IntelliJ idea, which no commit is the one I created for myself, and I personally have a habit of putting some of the list inside that you don't need to commit for the time being. Change list is very common and important, this article is also emphasized before, so it must be taken seriously. unversioned Filesrepresents a file that is not added to the version control system in the project, and you can click it Click to browse and a popup list will pop up to display the files that are not added.

This Tab is a summary of the SVN information for the project, which is Repository very detailed and is where I usually use the most. If you click on this Tab and do not see the data, it is because you need to click on the red Circle this refresh button. The default filter under the first use is not me, I am accustomed to filter filtering according to user, so the filter in the arrows I choose User. After selection, as shown in callout 1, shows the individual user names participating in the project, and after selecting a user, callout 2 will show which records the user submitted. After selecting a commit record in the callout 2 area, callout 3 shows the specific submission details, and we can right-click on the file, which is similar to the action buttons mentioned above in this article.

In general, the SVN feature is very useful for managing and reviewing the code of people on the development team, so it is very highly recommended that you learn this feature.

Introduction to version control under IntelliJ idea

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.