create a local Git repository
- Open the project you want to store in a repository.
- On the main menu, choose .
- In the dialog that opens, specify the directory where you want to create a new Git repository.
- Put the required files under Git version control. The files appear in the Local Changes tab of the Version Control tool window, under the Default changelist
Alt+9
Basics
After a Git repository for a project is initialized, you need to add the project
data to it.
Adding all currently unversioned files to Git control
- Switch to the Version Control tool window and switch to the Local Changes tab. tool window.
- Expand the Unversioned Files node and choose from the context menu or pressCtrl+Alt+A.
Adding specific files to a local Git repository
Do one of the following:
- Switch to the Version Control tool window and switch to the Local Changes tab. Expand the Unversioned Files node, and select the files to be added. From the context menu, choose , or press Ctrl+Alt+A.
- Switch to the Project tool window and select the files to be added. From the context menu, choose or pressCtrl+Alt+A.
Adding Files to Version Control
If a new file is created with IntelliJ IDEA in a directory that is already under version control, it automatically adds to the active changelist with the status Added. All you have to do, is to commit this change.
IntelliJ IDEA's behavior on adding files is configurable in the General Settings tab of the Version Control dialog.
If a new file is created outside of IntelliJ IDEA, or silent adding is disabled, you have to explicitly add it to the version control.
Another approach is VCS-specific. You can import an entire directory to your repository, provided that you have the corresponding access rights. This action is helpful for putting a whole project under version control.
To explicitly add a file to version control
- Select file in the Project tool window.
- On the main
Version Control
menu or on the context menu of the
selected file, choose
<VCS> | Add.
Alternatively, use the Version Control tool window. Select the desired files in the Unversioned files changelist in the Local Changes tab, and choose Add to VCS on the context menu, or just drag it to the target changelist.
- Select the added file in the changelist and check in (commit) changes.