Javatpoint Logo
Javatpoint Logo

IntelliJ IDEA Version Control

Version Control is a system which records the every modification in a file or a set of files over time so that we can recall specific version later. It allows us to revert selected files back to a previous state, entire project back to a previous state, compare the changes over time and so on. It could also help us to easily recover our lost file.

IntelliJ IDEA IDE supports many version controls such as Git, CVS, TFS, GitHub, Subversion, Mercurial etc. In this section, we will discuss about the most important version controls i.e. Git.

Git Integration

Git integration can be performed by the following methods:

  1. Make Id on the GitHub and create New Repository.
  2. Start IntelliJ IDE. Go to VCS->Enable Version Control Integration. Dialog box will open.
  3. Select version control system to associate with the project root and select Git in drop down menu.
  4. Git repository Created message shown us.

Now, we will understand and learn the working of Git tools and its terminology.

1. Clone

  • To do this, go to File->New->Project from Version Control->Git. Following Dialog box will open.

IntelliJ IDEA Version Control
  • Enter the Repository URL and Directory name and click clone button.
  • After successful running, the repository will get cloned.

2. Add files to repository

Go to VCS->Git->Add Option

3. Revert Local Changes

It will remove the local changes we have done. To do this:

  • Go to VCS->Git->Revert.
  • The Dialog box will open. Click Revert button.

IntelliJ IDEA Version Control

4. Commit Changes Locally

Commit action involves locally to record the snapshot of our repository in the project history. To commit changes to a local repository, do the following:

  • Select the modified file under Git version control.
  • Go to VCS->commit changes or VCS->Git->commit file. The following Dialog Box will open.

IntelliJ IDEA Version Control
  • In the changed file area we can see the file changed since the last commit. Select the check box of the files to be committed.
  • Enter the commit message and click commit button.

5. Push Changes to Remote Repository

It will send the local changes to the remote repository so that they can available for others. To do push action, follow the following steps:

  • Go to VCS->Git->Push. Dialog Box shown.

IntelliJ IDEA Version Control
  • We can see the commit to be pushed, select the commit and click on Push button.

6. Import Existing Project to Git

To add our existing project in the Git repository do the following:

  • Go to VCS->Import into version control->Create Git Repository. Dialog Box open.

IntelliJ IDEA Version Control
  • Select Project. Click Ok button.

7. Get Updates

To get updates from the repository, do the following -

  • Go to VCS->Git->Pull
  • Select the required option.
  • Click on Pull button.

IntelliJ IDEA Version Control

8. Show History or Log

To view History, do the following -

  • Go to VCS->Git->Show History Option
  • History window screen will appear.

IntelliJ IDEA Version Control

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA