Share code with GitLab snippets
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.
Press Ctrl+Alt+S to open settings and then select
.Open the Installed tab, find the Git plugin, and select the checkbox next to the plugin name.
Install the GitLab plugin
This functionality relies on the GitLab plugin, which you need to install and enable.
Press Ctrl+Alt+S to open settings and then select
.Open the Marketplace tab, find the GitLab plugin, and click Install (restart the IDE if prompted).
Use GitLab snippets to store and quickly share bits of code, files, or entire folders with others.
Create a snippet
Select a code fragment in the editor, or files and folders you want to include to the new snippet in the Project tool window (Alt+2).
Right-click the selection to open the context menu and then select Create Snippet.
The Create a GitLab Snippet dialog opens.
Specify the Project parameter:
If you want to create a project snippet, choose a project from the list of available GitLab projects you can create your snippet for.
To make this snippet listed under the chosen project, but visible only to you, keep the Private box checked.
If you want to create a personal snippet, choose None.
Add a title and, optionally, a description of the new snippet.
Specify the Path handling mode parameter to prevent duplication when passing the name of each file in the snippet to GitLab:
Relative: to find the nearest common parent of the selected files and pass along the paths to the files relative to that common parent.
Content root relative: to include the path of the files relative to the module.
Project relative: to include the path of the files relative to the project.
No paths: to pass along the filenames only, without a path.
Select the Private checkbox to make this snippet visible only to you.
Select the Copy URL checkbox to copy the link to the new snippet once it is created.
Select the Open in browser checkbox to open the new snippet in a default browser once the snippet is created.
Click OK.