Gitlab hero border pattern left svg Gitlab hero border pattern right svg

Category Direction - Snippets


Stage Create
Maturity Minimal
Content Last Reviewed 2020-03-16

Introduction and how you can help

Thanks for visiting this direction page on Snippets in GitLab. This page belongs to the Editor group of the Create stage and is maintained by Kai Armstrong (E-Mail).

This direction is a work in progress, and everyone can contribute:


GitLab Snippets allow users to share small bits of code and text by directly linking, downloading, or embedding them in web apps within a <script> HTML tag.

Commonly Snippets are often used for smaller pieces of code that are reused among several projects, additional documentation for specific one-off scripts/functions and instructions for using the main project.

We want to make snippets a more valuable tool in the engineering toolkit by first making each snippet behave more like a lightweight Git repository including support for multiple files. Once we've done that we'll work on improving and adding more sharing capabilities and adding the ability to execute snippets within GitLab.

Target Audience and Experience

Snippets are primarily targeted at engineering personas who are looking for ways to document and share information with other users. GitLab personas that represent this are:

Challenges to address

There are two themes of challenges that need to be kept in mind when evaluating the Snippets direction.

  1. There are existing technical challenges with GitLab's model for repositories and future directional items where compute may be required have also proved historically problematic. Scoping the required outcomes here will be important to successfully enable this functionality.

  2. Users of snippets have strong mental models of expected functionality based on existing competitors in the market. As new features are added to GitLab snippets to further running code or creating simple prototypes it will be important to gain feature parity and then build on top of that to increase adoption of the product.

Where we are headed

We want GitLab to be the first choice for developers looking to share or demo small samples and prototypes with other users either within their team on GitLab or externally via links and embeds. Adding the ability to version control snippets and support multiple files will be important as we continue to expand capabilities.

Once snippets behave like other git based projects we want to enhance sharing and interactive capabilities of snippets. We're aiming to support the ability to run simple scipts (e.g. python, ruby, shell) and support html/css/js and javascript framework based demos.

We also want snippets to follow standard embed capabilities so they can be used outside of GitLab easily. These enhancements will help to further make snippets a valuable tool for sharing knowledge across the ecosystem.

What's Next & Why

In Progress: Version controlled snippets - Snippets should be built on top of a Git repository so that they can be versioned. Versioning is one of the top 10 requested issues within all of GitLab.

Next: Snippets with multiple files - Snippets sometimes need more than one file to properly convey value. Adding support for multiple files brings us closer to parity with the market and supports users as one of the top 10 requested features for GitLab.

Maturity Plan

Currently, GitLab's maturity in Snippets is minimal. Here's why:

Viability for this category would be achieved by enabling either multiple file support or versioning. Given the proposed plan would add support for both of these simultaneously, Snippets would go directly to complete.

A complete snippets category would allow users to utilize snippets in way that aligns with other git functionality. Such as allowing multiple files to be shared (e.g. a mix of Javascript, CSS, HTML) or forked (e.g. I can make a copy of something interesting I see), or remixed (e.g. I can take a cool snippet and tweak it for my own use). GitLab has solved for movingtogitlab and supports the needs of those users looking for alternatives.

Lovable snippets come when we've graduated beyond a scratchpad and sharing and into a tool with interactive abilities to share and collaborate on snippets.

Competitive Landscape

Snippets capabilities are currently most close to Pastebin.

The primary competitor is Gists which is a no frills way to share snippets of code that are version controlled with Git. They allow multiple files to be shared (e.g. a mix of Javascript, CSS, HTML), forked (e.g. I can make a copy of something interesting I see), and remixed (e.g. I can take a cool snippet and tweak it for my own use). By being a Git repository, they are familiar to Git users and can be used in a variety of interesting ways from the command line.

A range of clever tools have since been built on top of Gists including:

Atlassian has Bitbucket Snippets which is very similar to Gists, supporting Git and Mercurial.

If Snippets were combined with the Web IDE with client-side and server-side evaluation it would also compete with:

Analyst Landscape

Snippets and pastebins are not currently an area of analyst interest.

Top Customer Success/Sales issue(s)

Top user issue(s)

Snippets in their current form lack feature parity with Github's Gists or Bitbucket's Snippets with both supporting multiple files and the former also supporting forks. The following two features are some of the most requested, particularly by users movingtogitlab:

Top internal customer issue(s)

Snippets are not used regularly internally, but we are working to change this in accordance to our dogfood everything approach.

Top Strategy Item(s)