DataGrip 2025.3 Help

Getting started with Git in DataGrip

Enable the Git plugin

This functionality relies on the Git plugin, which is bundled and enabled in DataGrip by default. If the relevant features are not available, make sure that you did not disable the plugin.

  1. Press Ctrl+Alt+S to open settings and then select Plugins.

  2. Open the Installed tab, find the Git plugin, and select the checkbox next to the plugin name.

Install the GitHub plugin

This functionality relies on the GitHub plugin, which you need to install and enable.

  1. Press Ctrl+Alt+S to open settings and then select Plugins.

  2. Open the Marketplace tab, find the GitHub plugin, and click Install (restart the IDE if prompted).

This tutorial will guide you through the most popular Git operations and show how they can be performed in DataGrip. You will learn how to create Git repositories from your projects, share them on GitHub, commit and push changes, create and merge branches, resolve merge conflicts, and investigate the files' history.

Step 1. Create a new project with a Git repository

In this tutorial, we will create a simple project, share it on GitHub, and perform some Git tasks.

  1. Launch DataGrip and click New Project on the Welcome screen.

  2. In the dialog that opens, click New Project. In the New Project dialog, specify the new project name or path.

    %alt_new_project

    Click OK. The new project will open in DataGrip.

  3. From the main menu, select VCS | Create Git Repository. In the file browser, select the project directory where you want to create the Git repository.

Dedicated tool windows for working with Git become available.

Git integration enabled
  1. Git Branches popup: manage Git branches and perform basic Git operations.

  2. Commit tool window (Ctrl+K or View | Tool Windows | Commit): review the local changes and commit them to the local Git repository.

  3. Git tool window (Alt+9 or View | Tool Windows | Git): work with the Git log and more.

Step 2. Add files to Git

Once the Git integration is enabled, DataGrip shows which files have been modified, which new files have been added to Git, and which files are not being tracked by Git.

To learn how it works, let's create a simple README.md file with a short description and add it to Git.

  1. In the Files tool window Alt+2, select the project directory (gitdemo).

  2. Right-click the project directory and select New | File. Name the file README.md.

  3. In the dialog that opens, click Add so that Git could start tracking the file.

    Add a new file to Git

    Now when you modify this file, DataGrip automatically indexes any changes (in other words, adds them to the Git staging area) so that you do not have to do that manually.

  4. Add the following text to the newly created file:

    #Tutorial This is a tutorial where you will learn how to create Git repositories from your projects and share them on GitHub.

    We will use it later to learn how to solve merge conflicts.

Now the new file is tracked by Git and is added to the Changes changelist in the Commit tool window Alt+0.

Changes changelist with a newly created file

The Changes changelist helps you manage local changes that have not yet been committed to a Git repository. Learn more in Group changes into changelists.

There is also the Unversioned Files changelist with the list of files that belong to your project but are not yet added to the Git repository. We will not work with them in this tutorial, but you can always learn more about unversioned files in Exclude files from version control (ignore).

Step 3. Commit your project to the local Git repository

Now let's add all the files you want to share to the repository and commit them to save their current state.

  1. In the Commit tool window Alt+0, select the files you want to commit by clicking the checkboxes next to them.

  2. Type a message for your first commit:

    Commit message in the Commit tool window
  3. Click Commit. DataGrip notifies you after a successful commit:

    The Files Commited notification

    If you have not used Git on your computer, right before committing your changes DataGrip will ask you to enter your username and your email. Git will store this information in .git/config in order to assign you as an author to your commits.

Step 4. Share your project on GitHub

To make your project available for other contributors, you need to publish it to a remote repository, for example, on GitHub or on GitLab. DataGrip provides integration with both these platforms that requires the corresponding plugins to be installed in the IDE: GitHub and GitLab. Learn more details in Manage projects hosted on GitHub and Manage projects hosted on GitLab.

In this tutorial, we will publish our project on GitHub.

  1. In the main menu, go to Git | GitHub | Share Project on GitHub.

  2. In the dialog that opens, you can change the repository name (by default, it is the same as the project name), the name of a remote (by default, origin), choose the repository type (public or private), and add some description if needed.

    If you are not registered on GitHub, click Add account and then Log In via GitHub.

    The Share Project on GitHub dialog

    Enter your GitHub credentials in the browser window that opens or create a new account there. When you go back to DataGrip, the Share by field will show your account's name.

  3. Click Share. After the project is successfully published on GitHub, the following notification will appear:

    The repo is shared on GitHub

    Click the link in the notification to open the repository on GitHub.

Step 5. Create a new branch

You may need to create a separate branch, for example, when you are working on a new feature and you don't want your changes to get into the main branch before they are tested.

  1. Press Ctrl+T to pull the latest version of the current branch.

  2. The Git Branches popup displays the name of your current branch — main. Click it, select the main branch in the Local node and then New Branch from 'main'.

    Git branch menu
  3. In the dialog that opens, specify the branch name, for example, new_feature, and select the Checkout branch checkbox to switch to the new branch right away.

    New Git branch

    Now you are switched to the newly created branch:

    Switched to the new branch

Step 6. Make and view the changes

  1. Add a new file to the project (for example, git-features.md) and click Add when DataGrip suggests adding it to Git version control.

    After that, open the README.md file and replace the existing text with the new description:

    #Demo This is a demo project where you will learn how to commit and push changes, create and merge branches. Refer to `git-features.md` to check the list of Git operations.

    In the Files tool window Alt+2 and in the editor tabs, DataGrip applies different colors to files: blue to modified, green — to newly added. Moreover, in the gutter area of a modified file, the colored change markers appear next to the modified lines.

    Changes in Editor and Files tool window
  2. To review what exactly was changed, click the gutter marker:

    Colored change markers

    To view the difference in a separate editor tab, click the Show diff icon:

    Diff for range
  3. Go to the Commit tool window Alt+0, to preview all the changes at once. Double-click a file to open the diff view in the editor:

    Local Changes

    Learn more in Investigate changes in Git repository.

Step 7. Commit and push the changes

In our new_feature branch, we have created a new git-features.md file and have modified the README.md file. Let's commit our changes and push them to the remote repository.

  1. In the Commit tool window Alt+0, select the checkboxes next to both our files, and type the commit message (for example, Update README.md).

    When typing the commit message, you can use auto-completion for the project file names Ctrl+Space:

    Completion in the commit message

    Click Commit.

  2. Press Ctrl+Shift+K or select Git | Push from the main menu to push the changes to the remote repository. The Push Commits dialog opens. Here you can review all the commits to be pushed as well as all the affected files. Before pushing the changes, you can review the differences for each file. To do this, right-click a file and select Show Diff or press Ctrl+D:

    Push commits
  3. Click Push.

Step 8. Merge branches and resolve conflicts

There are several ways how you can apply the changes from one branch to another, such as merging and rebasing the branches, cherry-picking commits, applying separate changes or files. All these methods are described in detail in Merge, rebase, or cherry-pick to apply changes.

In this tutorial, you will learn how to merge two branches. We will also make a merge conflict on purpose to learn how to easily resolve merge conflicts using DataGrip's merge tool.

Merge branches

  1. Select the main branch in the Git Branches popup and click Checkout.

  2. In step 6, we have modified the README.md file in our new_feature branch. Now let's update the text one more time in the main branch to simulate a merge conflict, for example:

    #Tutorial This is a test project where you will learn how to work with the most popular Git operations.

    Commit and push the change as described in step 7.

  3. In the Local node of the Git Branches popup, select new_feature and click Merge 'new_feature' into 'main'.

    Merge option in the Branches popup menu

Since we have made changes for the same file in different branches, the Conflicts dialog appears.

Conflicts dialog

Resolve conflicts

  1. In the Conflicts dialog, you have several options to resolve the conflict:

    • Accept Yours to keep the changes made in the current branch.

    • Accept Theirs to apply the changes from the branch that you want to merge into the current one.

    • Merge to resolve conflicts manually in a dedicated dialog.

    Click Merge. The Merge Revisions dialog opens:

    Resolve conflict
    • The left pane called Changes from main shows the read-only changes from the local copy.

    • The right pane called Changes from new_feature shows the read-only incoming changes from the new_feature branch that we want to merge to main.

    • The central pane called Result is a fully-functional editor with the results of resolving conflicts.

  2. In this dialog, you can accept changes by clicking the Apply changes from the left/the Apply changes from the right, decline them by clicking , and type code in the Result pane in the middle. Learn more in Resolve Git conflicts.

    Let's accept one change from main from the left pane by clicking the Apply changes from the left. As we do not need the changes for the same line that come from new_feature, click Remove in the right pane in the red conflicting line to discard them.

    Click the Apply changes from the right on the right pane for the remaining non-conflicting changes that come from new_feature.

    Review merge results in the central pane. The merged text should look like this:

    #Demo This is a test project where you will learn how to work with the most popular Git operations. Refer to `git-features.md` to check the list of Git operations.
    Conflicts resolved

    Click Apply.

  3. Push the changes to the remote repository by pressing Ctrl+Shift+K or selecting Git | Push from the main menu.

You can review the commits in all the branches in the Log tab of the Git tool window Alt+9:

The Git Log tab

From here, you can also revert commits, cherry-pick changes from one branch to another, and more. Refer to Log tab for more details.

Step 9. View history

When you work on a project with other people, you may have questions like why, when, and how this file was changed.

In the main branch, open the README.md file. To find out in which commit these changes came from, do one of the following:

  • Right-click the file in the editor or in the Files tool window Alt+2 and select Git | Show History. The History tab of the Git tool window opens:

    Git file history

    On this tab, you can view all commits that affected the file and find out in which commit the change of your interest was added.

  • In the editor, select a code fragment you want to view history for, right-click the selection, and choose Git | Show History for Selection. The History for Selection window will open:

    Git history for selection

    Here you can review all the commits that affected the code selection of your interest.

Find more ways of exploring the Git history in Investigate changes in Git repository.

What's next

If you didn't find how to perform some specific Git task in this tutorial, refer to the Git guidelines — all the Git operations available from the IDE are described there.

If your project is not under Git, you can still track and manage local changes, roll back to the specific file state, restore deleted files, and more using the Local History feature.

20 November 2025