JetBrains Rider 2024.1 Help

Share code with GitLab snippets

Use GitLab snippets to store and quickly share bits of code, files, or entire folders with others.

Create a snippet

  1. 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+1).

  2. Right-click the selection to open the context menu and then select Create Snippet.

    The Create a GitLab Snippet dialog opens.

    A dialog with a list of options to create a GitLab snippet
  3. 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.

  4. Add a title and, optionally, a description of the new snippet.

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

  6. Select the Private checkbox to make this snippet visible only to you.

  7. Select the Copy URL checkbox to copy the link to the new snippet once it is created.

  8. Select the Open in browser checkbox to open the new snippet in a default browser once the snippet is created.

  9. Click OK.

Last modified: 07 March 2024