Introduction to Version Control in IntelliJ IDEA (Part 2)

In " Introduction to Version Control in IntelliJ IDEA ", we have already briefly understood the version control mechanism of IntelliJ IDEA, then let's take a look at the specific version control operations in IntelliJ IDEA.

2

  • Note 1: Checkout from Version Control, check out the project from the version control system;
  • Note 2: Version control systems supported by IntelliJ IDEA, including GitHub, CVSand Gitetc.

As shown in the image above, we can pass Checkout from Version Control, check the project from version control systems such as GitHub, CVSand Gitetc. In contrast, since we can check out the project from the version control system, we can also upload the project to the version control system.

3

  • Note 1: Import into Version Control, upload the project to the version control system;
  • Note 2: Version control systems supported by IntelliJ IDEA, including GitHub, CVSand Gitetc.

As shown in the figure above, through the above operations, the code can be uploaded to the version control system.

Now, taking the project on the blogger's GitHub mybatis-tutorialas an example, check out the project:

GitHub

As shown in the figure above, first select Checkout from Version Control -> GitHub, log in to the account, then select the project we want to check out, click Clone, this concept of "clone" comes from Git, which means to check out the project of the remote warehouse to the local:

check

As shown in the figure above, Cloneafter clicking, we are prompted to confirm the item to be checked out, click Yes, then all the way Next, and finally click Finish:

mybatis

As shown in the figure above, so far, the project mybatis-tutorialhas been successfully checked out from GitHub to the local!

button

As shown in the red mark in the figure above, they are all buttons for version control, from left to right:

  • Update Project, update the project, that is, download the latest version of the code from the checkout repository;
  • Commit changes, commit all the changed files on this checked out version of the project;
  • Compare with the Same Repository Version, compare the differences between the current file and the remote repository version file;
  • Show history, displays the history of the current file;
  • Revert, to restore the currently modified file to an unmodified version state.

commit

  • Note 1: There are modified files in the checked out project;
  • Note 2: To Comiit Messsagesubmit information, we need to fill in it ourselves;
  • Mark 3: Diff, show the comparison before and after file modification;
  • Note 4: Show that several files have been modified and several new files have been created;
  • Note 5: Before Commit, before submitting the project, perform some pre-operations;
  • Note 6: After Commit, after submitting the project, perform some post-operations.

Among them, Diffthe detailed comparison before and after file modification is shown, we need to make good use of it; Before Commit, the code analysis before submission is performed by default, and some errors and warnings can be checked. In addition, we can also   zoom in on the differences before and after modification by double-clicking the file shown in Mark 1 . Next, click Comiitto verify:

Code

As shown in the figure above, the results of the code analysis are displayed. For details, please refer to " Detailing the Code Analysis mechanism before submitting code in IntelliJ IDEA ".

Finally, let's go back Version Controland learn about some commonly used operations:

config

  • Note 1: When files are created, which indicates how IntelliJ IDEA handles when new files are put into the project. The default is Show options before adding to version control, which means that a prompt option will pop up, and let us decide whether to add these new files to version control. If you do not want to pop up a prompt, select the following two options for the default operation.
  • Note 2: When files are deleted, indicates how IntelliJ IDEA handles when a new file is deleted in the project, the default is Show options before removing from version control, which means a pop-up prompt option, let us decide whether to remove these deleted files from version control Removed from control. If you do not want to pop up a prompt, select the following two options for the default operation.

ignore

As shown in the figure above, we can +add files or directories that we do not want to add version control to the ignore list with the red mark; conversely, we can also circle the red mark -to add files or directories that we want to version control. Remove from ignore list. Here, we need to pay attention: when a file or directory is added to this "ignore list", the file or directory cannot perform version control related operations, such as committing .


———— ☆☆☆ ——Back-  >The easiest IntelliJ IDEA tutorial in history<- Contents——  ☆☆☆ ————

Guess you like

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