Add files to Git and track changes
Open the Commit tool window Alt00.
Put any files in the Unversioned Files changelist under version control by pressing CtrlAlt0A or selecting Add to VCS from the context menu. You can either add the entire changelist or select separate files.
If you have enabled Git integration for your project, IntelliJ IDEA suggests adding each newly created file under version control. You can change this behavior in the Settings dialog CtrlAlt0S under Version Control | Confirmation. If you want certain files to always remain unversioned, you can configure Git to ignore them.
tip
You can also add files to your local repository from the Project tool window. Select the files you want to add, and press CtrlAlt0A or choose Git | Add from the context menu.
IntelliJ IDEA allows you to check the status of your local working copy compared to the repository version of the project. It lets you see which files have been modified, which new files have been added to Git, and which files are not being tracked by Git.
Open the Commit tool window Alt00.
The Changes changelist shows all files that have been modified since you last synchronized with the remote repository (highlighted in blue), and all new files that have been added to Git, but have not been committed yet (highlighted in green).
The Unversioned Files changelist shows all files that have been added to your project, but that are not being tracked by Git.
tip
If you want ignored files to be also displayed in the Changes view, click on the toolbar and select Show Ignored Files.
You can also track changes to a file as you modify it in the editor. All changes are highlighted with change markers that appear in the gutter next to the modified lines and show the type of changes introduced since you last synchronized with the repository. When you commit changes to the repository, change markers disappear.
The changes you introduce to the text are color-coded:
tip
You can customize the default colors for line statuses on the Editor | Color Scheme | VCS page of the IDE settings CtrlAlt0S.
To disable VCS markers in the gutter, deselect the Highlight modified lines in gutter option on the Version Control | Confirmation page of the IDE settings CtrlAlt0S.
You can manage changes using a toolbar that appears when you hover over a change marker and then click it. The toolbar is displayed together with a frame showing the previous contents of the modified line:
You can roll back changes by clicking and explore the differences between the current and the repository version of the current line by clicking . To highlight the fragments that were changed, click .
Instead of reverting the whole file, you can copy any part of the contents of this popup and paste it into the editor.
If you delete a file that is under version control, it still exists in the repository until you've committed the changes. The deleted file is placed in the active changelist and is highlighted in grey.
Select a file in the Project tool window and press Delete or choose Delete from the context menu.
In the dialog that opens, you can choose whether you want to delete this file without searching for usages or to perform safe delete (to make sure that you are deleting an unused file) by checking the Safe delete option.
If any usages have been found, the Usages Detected dialog will pop up listing them. You can view these usages and remove references to this file before deleting it.
Commit the changes to the repository.
Thanks for your feedback!