Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

One of the nicest things about IntelliJ IDEA is its seamless integration with major version controls like Git, GitHub, Subversion, Mercurial, Perforce, TFS, CVS, Visual SourceSafe and Rational ClearCase.

1. Check out a project from version control

To import a project from version control click the Check out from Version Control button on the Welcome screen, or use the same command from the VCS on main menu.

If the project has Maven or Gradle build files, IntelliJ IDEA will offer to use them for configuration.

2. Version control settings

Project version control settings are accessed via SettingsVersion Control. You can associate any of the project folders with a repository root. These associations can be removed at any time, or you can even opt to disable the version control integration entirely.

IntelliJ IDEA can handle multiple VCS repositories assigned to different folders of the project hierarchy and perform all VCS operations on them uniformly.

3. Changes tool window and changelists

After version control is enabled for a project, you can see and manage your local changes via the Changes tool window. To quickly access the tool window use the Alt + 9 (Cmd+9 for Mac) shortcut.

To make working with changes easier, all changes are organized into changelists that can be created, removed, and made active.

4. VCS operations quick list

When you need to perform a VCS operation from on a currently selected file, directory, or even on the entire project, use the VCS operations quick list via the Alt + Back Quote (Ctrl + V for Mac) shortcut.

5. Show history

The changes history is available for a set of files or directories via the VCS operations quick list, or in the main menu VCS → <Version control name> → Show History, or the context menu <Version control name> → Show History.

To see all changes for a specific piece of code, use the Show History for Selection action.

6. Annotation

Annotations are available from both the quick list, the main and context menus, and they allow you to see who and when changed this or that line of code.

When you click annotation, you will see the detailed information about corresponding commit.

7. Useful shortcuts

  • Commit current changelist Ctrl + K (Cmd + K for Mac)
  • Update the project Ctrl + T (Cmd + T for Mac)
  • Mark selected files and folders as added Ctrl + Alt + A (Alt + Cmd + A for Mac)
  • Mark selected files and folders as changed (checked out) via Ctrl + Alt + E (Alt + Cmd + E for Mac)
  • Show diff (available in the Changes tool window) via Ctrl + D (Cmd + D for Mac)
  • Move changes to another change list (available in the Changes tool window) via F6
  • Push commits to remote repositories via Ctrl + Shift + K (Cmd + Shift + K for Mac)

8. Commit options

When committing changes, IntelliJ IDEA lets perform a variety of operations: change the file set to commit to, join the changes with the previous commit by using the Amend commit option, reformat the changed code, optimize imports, ensure that there are no inspection warnings, update the copyright information, or even upload the changes to a remote FTP server.

9. Ignored files

To configure the ignored files go to SettingsVersion Control, or use the corresponding button in the Changes tool window.

The actual list of ignored files can be displayed in the Changes tool window next to the changelists by clicking the corresponding button.

10. Branches

With IntelliJ IDEA you can easily create, switch, merge, compare and delete branches (Git and Mercurial only). To see a list of existing branches or create a new one, use either the Branches from the main or context menu, or the VCS operations quick list, or the widget on the right side of the status bar.

For multiple repositories IntelliJ IDEA performs all VCS operations on all branches simultaneously, so you don't need to switch between them manually.

11. Shelves, stashes, and patches

The Shelves and Stashes help you when you need to put away some of local changes without committing them to repository, then switch to repository version of files, and then come back to your changes later. They differ slightly in that the Shelves are handled by IntelliJ IDEA itself and are stored in local file system, while stashes are kept in a VCS repository. The Patches allow you to save a set of changes to a file that can be transferred via email or file sharing and then applied to the code. It’s helpful for when you're working remotely without having a constant connection to your VCS repository and still need to contribute.

12. Log

To see the entire list of commits in a repository, sorted and filtered by branch, user, date, folder, or even a phrase in description, use the Log tab in the Changes tool window. This is the easiest way to find a particular commit, or to just browse through the history.

This is it for the VCS basics. See the following tutorials for more advanced topics.

  • No labels