1. Check out a project from version control
To import a project from version control click theCheck out from Version Controlbutton on theWelcome screen, or use the same command from theVCSon 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 viaSettings→Version 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 theChangestool window. To quickly access the tool window use theAlt+9(Cmd+9for 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 theVCS operationsquick list via theAlt+Back Quote(Ctrl+Vfor Mac) shortcut.
5. Show history
The changes history is available for a set of files or directories via theVCS operationsquick list, or in the main menuVCS→ <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 theShow History for Selection action.
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 the annotation, you will see the detailed information about the corresponding commit.
7. Useful shortcuts
Commit current changelistCtrl+K(Cmd+Kfor Mac)
Update the projectCtrl+T(Cmd+Tfor Mac)
Mark selected files and folders as addedCtrl+Alt+A(Alt+Cmd+Afor Mac)
Mark selected files and folders as changed (checked out) viaCtrl+Alt+E(Alt+Cmd+Efor Mac)
Show diff (available in theChangestool window) viaCtrl+D(Cmd+Dfor Mac)
Move changes to another change list (available in theChangestool window) viaF6
Push commits to remote repositories viaCtrl+Shift+K(Cmd+Shift+Kfor 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 theAmend commitoption, 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 toSettings→Version Control, or use the corresponding button in theChangestool window.
The actual list of ignored files can be displayed in theChangestool window next to the changelists by clicking the corresponding button.
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 theBranchesfrom the main or context menu, or theVCS operationsquick 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
TheShelvesandStasheshelp 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 theShelvesare handled by IntelliJ IDEA itself and are stored in local file system, while stashes are kept in a VCS repository. ThePatchesallow 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.
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 theLogtab in theChangestool 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.