File tree browser

  • Tier: Free, Premium, Ultimate
  • Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated

Version history

The availability of this feature is controlled by a feature flag. For more information, see the history.

The file tree browser is a drawer that displays your repository's files and directories in a collapsible tree structure. Use it to navigate your repository without scrolling through long file listings.

The file tree browser helps you:

  • Navigate nested directory structures.
  • View the repository hierarchy.
  • Switch between files while maintaining context of the directory structure.

Show or hide the file tree browser

To show or hide the file tree browser:

  1. On the left sidebar, select Search or go to and find your project.
  2. Go to your repository files at /<project>/-/tree/<branch>.
  3. In the upper-left corner, select the file tree browser icon ({file-tree}).

You can also press Shift+F to toggle the file tree browser.

Navigate files and directories

The file tree browser displays your repository's structure with files and directories you can expand and collapse.

To navigate in the file tree browser:

  1. Open the file tree browser. Either:

    • In the upper-left corner, select the file tree browser icon ({file-tree}).
    • Press Shift+F.
  2. To expand a directory, select {chevron-right} next to the directory name.

  3. To view a file, select the filename.

When you navigate directly to a nested file, the file tree browser automatically expands parent directories and highlights the current file.

Search files

Use the global search to find files by name in your repository.

To search files:

  1. Open the file tree browser. Either:

    • In the upper-left corner, select the file tree browser icon ({file-tree}).
    • Press Shift+F.
  2. To open the global search dialog, select Search files or press F.

  3. Enter part of the filename you want to find. The results list shows matching files and their parent directories.

  4. Select or use the arrow keys and press Enter to go to a file.

If no files match your search, the search displays No results found.

Keyboard shortcuts

The file tree browser supports these keyboard shortcuts:

Shortcut Action
Shift+F Show or hide the file tree browser.
F Open the global search dialog.

For the full list of available keyboard shortcuts, see GitLab keyboard shortcuts.

Tree navigation

The file tree browser implements the W3C ARIA treeview pattern for keyboard navigation:

Key Function
Enter or Space Select the focused file or directory
Down arrow Move focus to the next file or directory without opening or closing directories. Does nothing if focus is on the last item.
Up arrow Move focus to the previous file or directory without opening or closing directories. Does nothing if focus is on the first item.
Right arrow When focus is on a closed directory, open it. When focus is on an open directory, move focus to the first item inside. Does nothing if focus is on a file.
Left arrow When focus is on an open directory, close it. When focus is on a file or nested item, move focus to its parent directory. Does nothing if focus is on a closed root directory.
Home 1 Move focus to the first file or directory without opening or closing directories.
End 1 Move focus to the last file or directory without expanding closed directories.
a-z, A-Z Move focus to the next file or directory with a name starting with the typed character. Search wraps to the first item if no match is found. Ignores items inside closed directories.
* (asterisk) Expand all closed directories at the same level as the focused item. Focus does not move.

Footnotes:

  1. Home and End keys might not be available on all keyboards.