DataGrip 2024.3 Help

Add files to Git and track changes

Add files to Git

  1. Open the Commit tool window Alt+0.

  2. Put any files in the Unversioned Files changelist under version control by pressing Ctrl+Alt+A 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, DataGrip suggests adding each newly created file under version control. You can change this behavior in the Settings dialog Ctrl+Alt+S under Version Control | Confirmation. If you want certain files to always remain unversioned, you can configure Git to ignore them.

Check project files status

DataGrip 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 Alt+0.

Files with various statuses in the Commit tool window
  • 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.

Track changes to a file in the editor

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:

Highlighting colors for added, changed, and deleted lines

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:

The modified line marker and toolbar

You can roll back changes by clicking the Revert icon and explore the differences between the current and the repository version of the current line by clicking the Show diff icon. To highlight the fragments that were changed, click the Highlighting button.

Instead of reverting the whole file, you can copy any part of the contents of this popup and paste it into the editor.

Check file status

DataGrip allows you to check the status of project files relative to the repository. File status shows you which operations have been performed on the file since you last synchronized with the repository.

You can check the status of a file in any interface element (for example, the editor or a tool window) by the color used to highlight the filename.

You can customize the default colors for file statuses on the Colors and Fonts settings page.

You can configure VCS file status colors on the Version Control | File Status Colors page of settings  Ctrl+Alt+S.

The table below lists default file status colors and their meanings in some of the color schemes.

Color

File Status

Description

Color sample: dark green #0A7700

Added

The file in the active changelist is scheduled for addition to the repository.

Color sample: green #0EAA00

Added in not active changelist

The file in an inactive changelist is scheduled for addition to the repository. This file status is available if the Highlight files from non-active changelists option is enabled in Settings | Version Control | Changelists.

Color sample: red #FF0000

Changelist conflict

The file in an inactive changelist has been modified in the active changelist. In this case, a new dialog will open, prompting you to resolve the changelist conflict. This file status is available if all options are enabled in Settings | Version Control | Changelists.

Color sample: dark green #0A7700

Copied

If a file is a copy of another file, its metadata is tracked, and such a file is marked as copied.

Color sample: grey #616161

Deleted

The file is scheduled for deletion from the repository.

Color sample: dull purple #773895

Deleted from file system

The file has been deleted locally but hasn't been scheduled for deletion, and it still exists in the repository.

Color sample: light grayish blue #8AA4C8

Have changed descendants

If a file is modified, the IDE will recursively highlight all directories containing that file. This status is available if the Highlight directories that contain modified files in the Project tree option is enabled in Settings | Version Control | Confirmation.

Color sample: bright blue #3264B4

Have immediate changed children

If a file is modified, the IDE will highlight its parent directory. This status is available if the Highlight directories that contain modified files in the Project tree option is enabled in Settings | Version Control | Confirmation.

Color sample: light brown #B28C00

Hijacked

[Perforce, ClearCase, VSS] The file is modified without checkout.

Color sample: dark olive #727238

Ignored

A file is intentionally untracked by VCS.

Color sample: purple #7503DC

Merged

The file is merged by your VCS as a result of an update.

Color sample: red #FF0000

Merged with conflicts

During the last update, the file has been merged with conflicts.

Color sample: red #FF0000

Merged with property conflicts

During the last update, the IDE has detected differences between the properties of the local file and its server version.

Color sample: red #FF0000

Merged with text and property conflicts

Text and property conflicts happen when two or more developers modify the same lines of a file and the same file properties.

Color sample: bright navy #0032A0

Modified

The file has changed since the last synchronization.

Color sample: blue #0047E4

Modified in not active changelist

The file in an inactive changelist has been modified. This file status is available if the Highlight files from non-active changelists option is enabled in Settings | Version Control | Changelists.

Color sample: Olive #7C7C00

Obsolete

The file should no longer be in your working copy of the repository.

Color sample: teal #007C7C

Renamed

Since the last update, the file has been renamed.

Color sample: dark cyan #08978F

Switched

[SVN] The file is taken from a different branch than the whole project.

Color sample: brown #993300

(Unknown) Unversioned

The file exists locally but is not in the repository and is not scheduled for addition.

Color sample: black None (default color)

Up to date

The file hasn't been changed.

Color

File Status

Description

Color sample: dull green #629755

Added

The file in the active changelist is scheduled for addition to the repository.

Color sample: dull green #629755

Added in not active changelist

The file in an inactive changelist is scheduled for addition to the repository. This file status is available if the Highlight files from non-active changelists option is enabled in Settings | Version Control | Changelists.

Color sample: dull red #D5756C

Changelist conflict

The file in an inactive changelist has been modified in the active changelist. In this case, a new dialog will open, prompting you to resolve the changelist conflict. This file status is available if all options are enabled in Settings | Version Control | Changelists.

Color sample: green #0A7700

Copied

If a file is a copy of another file, its metadata is tracked, and such a file is marked as copied.

Color sample: grey #6C6C6C

Deleted

The file is scheduled for deletion from the repository.

Color sample: dull purple #6C6C6C

Deleted from file system

The file has been deleted locally but hasn't been scheduled for deletion, and it still exists in the repository.

Color sample: light blue #6897BB

Have changed descendants

If a file is modified, the IDE will recursively highlight all directories containing that file. This status is available if the Highlight directories that contain modified files in the Project tree option is enabled in Settings | Version Control | Confirmation.

Color sample: light blue #6897BB

Have immediate changed children

If a file is modified, the IDE will highlight its parent directory. This status is available if the Highlight directories that contain modified files in the Project tree option is enabled in Settings | Version Control | Confirmation.

Color sample: white None (default color)

Hijacked

[Perforce, ClearCase, VSS] The file is modified without checkout.

Color sample: light olive #848504

Ignored

A file is intentionally untracked by VCS.

Color sample: light purple #9876AA

Merged

The file is merged by your VCS as a result of an update.

Color sample: dull red #D5756C

Merged with conflicts

During the last update, the file has been merged with conflicts.

Color sample: dull red #D5756C

Merged with property conflicts

During the last update, the IDE has detected differences between the properties of the local file and its server version.

Color sample: dull red #D5756C

Merged with text and property conflicts

Text and property conflicts happen when two or more developers modify the same lines of a file and the same file properties.

Color sample: light blue #6897BB

Modified

The file has changed since the last synchronization.

Color sample: light blue #6897BB

Modified in not active changelist

The file in an inactive changelist has been modified. This file status is available if the Highlight files from non-active changelists option is enabled in Settings | Version Control | Changelists.

Color sample: white None (default color)

Obsolete

The file should no longer be in your working copy of the repository.

Color sample: strong cyan #3A8484

Renamed

Since the last update, the file has been renamed.

Color sample: white None (default color)

Switched

[SVN] The file is taken from a different branch than the whole project.

Color sample: soft red #D1675A

(Unknown) Unversioned

The file exists locally but is not in the repository and is not scheduled for addition.

Color sample: white None (default color)

Up to date

The file hasn't been changed.

Color

File Status

Description

Color sample: green #62CC47

Added

The file in the active changelist is scheduled for addition to the repository.

Color sample: green #62CC47

Added in not active changelist

The file in an inactive changelist is scheduled for addition to the repository. This file status is available if the Highlight files from non-active changelists option is enabled in Settings | Version Control | Changelists.

Color sample: dull red #FF6666

Changelist conflict

The file in an inactive changelist has been modified in the active changelist. In this case, a new dialog will open, prompting you to resolve the changelist conflict. This file status is available if all options are enabled in Settings | Version Control | Changelists.

Color sample: green #62CC47

Copied

If a file is a copy of another file, its metadata is tracked, and such a file is marked as copied.

Color sample: orange #ED864A

Deleted

The file is scheduled for deletion from the repository.

Color sample: orange #ED864A

Deleted from file system

The file has been deleted locally but hasn't been scheduled for deletion, and it still exists in the repository.

Color sample: vivid cyan #4FF0FF

Have changed descendants

If a file is modified, the IDE will recursively highlight all directories containing that file. This status is available if the Highlight directories that contain modified files in the Project tree option is enabled in Settings | Version Control | Confirmation.

Color sample: vivid cyan #4FF0FF

Have immediate changed children

If a file is modified, the IDE will highlight its parent directory. This status is available if the Highlight directories that contain modified files in the Project tree option is enabled in Settings | Version Control | Confirmation.

Color sample: white None (default color)

Hijacked

[Perforce, ClearCase, VSS] The file is modified without checkout.

Color sample: light olive #A9B837

Ignored

A file is intentionally untracked by VCS.

Color sample: light purple #ED94FF

Merged

The file is merged by your VCS as a result of an update.

Color sample: dull red #FF6666

Merged with conflicts

During the last update, the file has been merged with conflicts.

Color sample: dull red #FF6666

Merged with property conflicts

During the last update, the IDE has detected differences between the properties of the local file and its server version.

Color sample: dull red #FF6666

Merged with text and property conflicts

Text and property conflicts happen when two or more developers modify the same lines of a file and the same file properties.

Color sample: vivid cyan #4FF0FF

Modified

The file has changed since the last synchronization.

Color sample: vivid cyan #4FF0FF

Modified in not active changelist

The file in an inactive changelist has been modified. This file status is available if the Highlight files from non-active changelists option is enabled in Settings | Version Control | Changelists.

Color sample: white None (default color)

Obsolete

The file should no longer be in your working copy of the repository.

Color sample: vivid cyan #4FF0FF

Renamed

Since the last update, the file has been renamed.

Color sample: white None (default color)

Switched

[SVN] The file is taken from a different branch than the whole project.

Color sample: soft red D1675A

(Unknown) Unversioned

The file exists locally but is not in the repository and is not scheduled for addition.

Color sample: white None (default color)

Up to date

The file hasn't been changed.

Delete files from the repository

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.

  1. Select a file in the Files tool window and press Delete or choose Delete from the context menu.

  2. 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.

  3. Commit the changes to the repository.

Last modified: 23 September 2024