All features are free to use on all repos, except for features:
- marked with a ✨ require a trial or paid plan for use on privately hosted repos
- marked with a ☁️ require a GitKraken Account, with access level based on your plan, e.g. Free, Pro, etc
Revision Navigation
- Adds an Open Changes with Previous Revision command (
gitlens.diffWithPrevious
) to compare the current file or revision with the previous commit revision - Adds an Open Changes with Next Revision command (
gitlens.diffWithNext
) to compare the current file or revision with the next commit revision - Adds an Open Line Changes with Previous Revision command (
gitlens.diffLineWithPrevious
) to compare the current file or revision with the previous line commit revision - Adds an Open Changes with Working File command (
gitlens.diffWithWorking
) to compare the current revision or most recent commit revision of the current file with the working tree - Adds an Open Line Changes with Working File command (
gitlens.diffLineWithWorking
) to compare the commit revision of the current line with the working tree - Adds an Open Changes with Branch or Tag… command (
gitlens.diffWithRevisionFrom
) to compare the current file or revision with another revision of the same file on the selected reference - Adds an Open Changes with Revision… command (
gitlens.diffWithRevision
) to compare the current file or revision with another revision of the same file
Current Line Blame
Adds an unobtrusive, customizable, and themable, blame annotation at the end of the current line.
- Contains the author, date, and message of the current line’s most recent commit (by default)
- Adds a Toggle Line Blame Annotations (
gitlens.toggleLineBlame
) to toggle the blame annotation on and off
Git CodeLens
Adds Git authorship CodeLens to the top of the file and on code blocks (optional, on by default)
-
Recent Change — author and date of the most recent commit for the file or code block
- Click the CodeLens to show a commit file details quick pick menu with commands for comparing, navigating and exploring commits, and more (by default)
-
Authors — number of authors of the file or code block and the most prominent author (if there is more than one)
- Click the CodeLens to toggle the file Git blame annotations on and off of the whole file (by default)
- Will be hidden if the author of the most recent commit is also the only author of the file or block, to avoid duplicate information and reduce visual noise
-
Provides customizable click behavior for each CodeLens — choose between one of the following
- Toggle file blame annotations on and off
- Compare the commit with the previous commit
- Show a quick pick menu with details and commands for the commit
- Show a quick pick menu with file details and commands for the commit
- Show a quick pick menu with the commit history of the file
- Show a quick pick menu with the commit history of the current branch
-
Adds a Toggle Git CodeLens command (
gitlens.toggleCodeLens
) with a shortcut ofshift+alt+b
to toggle the CodeLens on and off
Status Bar Blame
Adds a customizable Git blame annotation showing the commit and author who last modified the current line to the status bar (optional, on by default)
-
Contains the commit author and date (by default)
-
Click the status bar item to show a commit details quick pick menu with commands for comparing, navigating and exploring commits, and more (by default)
-
Provides customizable click behavior — choose between one of the following
- Toggle file blame annotations on and off
- Toggle CodeLens on and off
- Compare the line commit with the previous commit
- Compare the line commit with the working tree
- Show a quick pick menu with details and commands for the commit (default)
- Show a quick pick menu with file details and commands for the commit
- Show a quick pick menu with the commit history of the file
- Show a quick pick menu with the commit history of the current branch
Hovers
Current Line Hovers
Adds customizable Git blame hovers accessible over the current line
Details Hover
Adds a details hover annotation to the current line to show more commit details (optional, on by default)
- Provides automatic issue linking to Bitbucket, Gerrit, Gitea, GitHub, GitLab, and Azure DevOps in commit messages
- Provides a quick-access command bar with Open Changes, Blame Previous Revision, Open on Remote, Invite to Live Share (if available), and Show More Actions command buttons
- Click the commit SHA to execute the Show Commit command
Changes (diff) Hover
Adds a changes (diff) hover annotation to the current line to show the line’s previous version (optional, on by default)
- Click the Changes to execute the Open Changes command
- Click the current and previous commit SHAs to execute the Show Commit command
Annotation Hovers
Adds customizable Git blame hovers accessible when annotating
Details Hover
Adds a details hover annotation to each line while annotating to show more commit details (optional, on by default)
- Provides automatic issue linking to Bitbucket, Gerrit, Gitea, GitHub, GitLab, and Azure DevOps in commit messages
- Provides a quick-access command bar with Open Changes, Blame Previous Revision, Open on Remote, Invite to Live Share (if available), and Show More Actions command buttons
- Click the commit SHA to execute the Show Commit command
Changes (diff) Hover
Adds a changes (diff) hover annotation to each line while annotating to show the line’s previous version (optional, on by default)
- Click the Changes to execute the Open Changes command
- Click the current and previous commit SHAs to execute the Show Commit command
File Blame
Adds on-demand, customizable, and themable, file blame annotations to show the commit and author who last modified each line of a file
- Contains the commit message and date, by default
- Adds a heatmap (age) indicator on right edge (by default,) of the file to provide an easy, at-a-glance way to tell how recently lines were changed (optional, on by default)
- See the file heatmap section below for more details
- Adds a Toggle File Blame Annotations command (
gitlens.toggleFileBlame
) with a shortcut of alt+b to toggle the blame annotations on and off - Press Escape to turn off the annotations
File Changes
Adds an on-demand, customizable, and themable, file changes annotation to highlight any local (unpublished) changes or lines changed by the most recent commit.
- Adds Toggle File Changes command (
gitlens.toggleFileChanges
) to toggle the changes annotations on and off - Press Escape to turn off the annotations
File Heatmap
Adds an on-demand heatmap to the edge of the file to show how recently lines were changed
- The indicator’s customizable color will either be hot or cold based on the age of the most recent change (cold after 90 days by default)
- The indicator’s brightness ranges from bright (newer) to dim (older) based on the relative age, which is calculated from the median age of all the changes in the file
- Adds Toggle File Heatmap Annotations command (
gitlens.toggleFileHeatmap
) to toggle the heatmap on and off - Press Escape to turn off the annotations
Cloud Patches preview ☁️
Cloud Patches allow you to easily share changes with other developers by creating a Cloud Patch from your WIP, commit or stash and sharing the generated link with your teammates.
Manage your Cloud Patches from the Cloud Patches view in the GitLens side bar.
Create a Cloud Patch from Working Changes, Commits, Stashes or Comparisons by using the "Share as Cloud Patch" option from the command palette or from the Share submenu in applicable gitlens views.
View Cloud Patches from URLs shared to you and apply them to your working tree or to a new or existing branch.
To delete a cloud patch, right-click it and select Delete Cloud Patch...
.
To disable cloud patches per client, open the user Settings (command/ctrl + shift + P
> Preferences: Open User Settings (JSON)
) and set gitlens.cloudPatches.enabled
to false
.
Commit Graph ✨
The commit graph helps visualize your repository commit history and give you information about branches, commits, and collaborators all in one view. This makes it easier to see contributions and help you make faster, more informed decisions.
To open the Commit Graph, open the command palette using the keyboard shortcut Cmd/ctrl + Shift + P
and type “Show Commit Graph”. This will open a new tab and render your current repo’s commit history, where you may scroll through your history and resize any of the columns widths.
At the top of the commit graph the repository name, the branch name that is currently checked out, and the last fetched time is shown. This section offers the ability to switch branches by selecting the branch name and the ability to fetch by selecting "Fetch".
Note: The Commit Graph is available to all users working on public repositories, and requires no account. Additionally, users with a paid GitLens subscription or trial can use the Commit Graph with private repos.
We’d love to hear your feedback in the Commit Graph discussion on GitHub.
Configuration and Layout
The commit graph can be configured to be shown as desired offering different settings for what to show and how or where to show it.
All columns can be rearranged by dragging and dropping the column headers. The columns can be toggled on/off from the column’s context menu via right-click. This enables you to arrange the columns in a way that best suits your workflow and priorities. The Changes column represents added (green) and deleted (red) lines made to each file within the commit.
A Commit Graph Panel Layout is offered to show the Commit Graph in the bottom Panel (near the Terminal) with a dedicated Commit Graph Details view alongside the Commit Graph. To switch between the Editor Layout and Panel Layout, select the Commit Graph settings gear located at the top right of the editor. From there, select the "Prefer Commit Graph in Panel Layout" or "Prefer Commit Graph in Editor Area". The Commit Graph can also be opened in both the Penel Layout and Editor Area simultaneously.
A compact layout for the Graph column is offered in the Commit Graph to reduce the visual complexity and size of the Graph column. To enable the compact layout, right click on the Graph column header, and select the Compact Graph Column Layout option. Additionally the Author column displays avatars instead of text when sized to its minimum width, which pairs nicely with the compact Graph column as you can retain avatars. Also, when the any of the Commit Graph columns are resized small enough so that their text would be truncated, they switch to displaying icons to ensure that crucial information remains visible, even in constrained display settings.
The scroll markers indicate points of interest on the commit graph such as checked-out branches, selected rows, and search results. This provides the ability to jump to important points like the HEAD or refs. This can be toggled on or off in the Commit Graph settings.
Settings
The Commit Graph settings can be adjusted by opening the Command Palette (command/ctrl + shift + P
) and searching "GitLens: Open Settings".
Rich Commit Search
The Commit Graph will highlight all matching results across your entire repository when searching for a commit, message, author, a changed file or files, or even a specific code change. Use shortcut keys or the up/down arrows on the search bar to navigate the search results; F3
(also Cmd+G
on macOS) goes to the next result from your selection while Shift+F3
( also Shift+Cmd+G
on macOS) goes to the previous.
Once you type search filtering criteria, use the arrow icons to move through each result. Additionally, you can quickly jump to the first or last result, by holding Shift
while clicking on the up/down arrows respectively.
The following options can be used to search:
Commit:
Message:
Author:
File:
Change:
@me
Additionally, the options on the right side of the search bar can be used to match all, match case, or use regular expression.
Full Context Menu Support
You can right-click a branch, commit, tag, author, or column headers (author, commit date / time, or SHA) to interact with them.
Context menu actions include but are not limited to:
- Switch to Branch
- Revert Commit
- Switch to Commit
- Create Branch
- Merge
- Rebase
- Create Worktree
- Create Pull Request
Pull Request Information
For GitHub and GitLab, the commit Graph will display a Pull Request icon for any branch that currently has a pull request. You will need to connect the rich integration in order to see this.
Hiding Remotes, Branches or Tags
The Commit Graph shows refs to your remotes, branches and tags. Hover over any of these refs to access the “Hide” option to help focus your Commit Graph. To show them again, hover over the "Hide" option at the top of the commit graph and select the desired refs.
Filter options can be accessed from the filter dropdown. This provides the ability to switch between Show Current Branch Only – to show the current branch and its upstream remote – or Show All Local Branches – this is selected by default. Additionally, remote-only branches, stashes and tags can be hidden/shown and merge commit rows can be dimmed.
Minimap (Experimental)
The Minimap provides an additional dimension to the Commit Graph. You can quickly see the activity of the repository, see the HEAD/upstream, branches (local and remote), and easily jump to them. Select the Toggle Minimap icon in the right corner of the Commit Graph top bar to toggle the Minimap on and off.
The Minimap can be toggled between showing commits or lines changed by selecting the graph icon dropdown in the top right of the Activity Minimap. Additionally, markers can be toggled on or off from here.
Minimap Overview:
- Reads left to right – left is the most recent and the right is older
- Highlighted region: Commit Graph area that is in view
- Green Lines: HEAD
- Yellow lines: Search results
- Upper row markers:
- Blue blocks: remote branches
- Brown blocks: Tags
- Lower row markers:
- Pink blocks: stashes
- Blue blocks: local branches
Note: We would love to hear your feedback regarding the Minimap. Please share it on the GitHub Discussion board.
Deep Linking
Deep Links are links that can be used to open up a resource within the Commit Graph of GitLens. This provides the ability to easily share specific remote repositories, commits, branches, and tags. To generate a deep link right-click the desired resource, hover over Share and select Copy Link to <resource>.
Focus View ✨
The Focus View allows you to stream line your workflow by providing a summarized list of your pull requests and your issues. To open the Focus View, open the command palette (command/ctrl + shift + P
) and search GitLens+: Show Focus view
.
Currently, this view is supported for GitHub repositories. In order to see the Focus View, you will need to connect the GitHub Integration.
Within the Focus View, you can show pull requests and/or issues that are opened by you, assigned to you, that need your review, or that mention you. Filters can be set to show only issues, pull requests, or all.
The Focus View offers the ability to perform actions on pull requests, issues, and branches:
- For pull requests, you can create or open a worktree or branch using the arrow and folder icon under the Actions column.
- For issues, you can open them on the remote service using the globe icon.
- For branches, you can click the branch name to open that branch on the commit graph.
Items in the Focus View can be pinned, to move the item to the top of the list, and can be snoozed, to be hide under the Snoozed section. To pin or unpin and item, click the pin in the pin/snooze column. To snooze an item, select the snooze icon. To unsnooze an item, click on the Snoozed section header and click the unsnooze icon for that item.
Note: The Focus View is currently organized by prioritizing items on the list that require more action by elevating them to the top. This is subject to change in the future.
Visual File History ✨
The Visual File History allows you to quickly see the evolution of a file, including when changes were made, how large they were, and who made them.
Authors who have contributed changes to the file are on the left y-axis to create a swim-lane of their commits over time (the x-axis). Commit are plotted as color-coded (per-author) bubbles, whose size represents the relative magnitude of the changes.
Additionally, each commit’s additions and deletions are visualized as color-coded, stacked, vertical bars, whose height represents the number of affected lines (right y-axis). Added lines are shown in green, while deleted lines are red.
Gain additional insights on hover.
AI-Generated Commit Messages (Experimental) ✨
Commit messages can be automatically generated using an AI Provider.
To connect an AI Provider, stage some changes you want to generate a commit message for and then run the GitLens: Generate Commit Message (Experimental)
command from the Command Palette (command/ctrl + shift + P
). From there you will be guided through the process of accepting to send the diff of your staged changes to the AI Provider and the entry of your AI Provider key. The API key can be created from your AI Provider’s site. Once completed, the generated commit message will be entered into the commit input box on the Source Control sidebar. You can also enter additional context about your changes in the commit box and those will also be sent to help generate a better message. Additionally, you can customize the gitlens.experimental.generateCommitMessagePrompt
setting to control the prompt used to structure and format the generated commit message. There are additional gitlens.ai
settings that can be customized for the provider and model.
To remove your AI Provider API key in GitLens, run the command GitLens: Reset Stored AI Key
from the Command Palette.
Git Command Palette
Adds a customizable Git Command Palette command (gitlens.gitCommands
) to provide guided (step-by-step) access to many common Git commands, as well as quick access to commit history and search, stashes, and more
- Quickly navigate and execute Git commands through easy-to-use menus where each command can require an explicit confirmation step before executing
Quick Commit Access
- Adds a Show Branch History command (
gitlens.showQuickBranchHistory
) to show a quick pick menu to explore the commit history of the selected branch - Adds a Show Current Branch History command (
gitlens.showQuickRepoHistory
) to show a quick pick menu to explore the commit history of the current branch
- Adds a Show File History command (
gitlens.showQuickFileHistory
) to show quick pick menu to explore the commit history of the current file
Adds a Search Commits command (gitlens.showCommitSearch
) to show quick pick menu to search for commits
- by message — use
<message>
to find commits with messages that match<message>
— See Git docs - or, by author — use
@<pattern>
to find commits with authors that match<pattern>
— See Git docs - or, by commit SHA — use
#<sha>
to find a commit with id of<sha>
— See Git docs - or, by files — use
:<path/glob>
to find commits with file names that match<path/glob>
— See Git docs - or, by changes — use
~<pattern>
to find commits with differences whose patch text contains added/removed lines that match<pattern>
— See Git docs
- Adds a Show Commit command (
gitlens.showQuickCommitDetails
) to show a quick pick menu to explore a commit and take action upon it
Adds a Show Line Commit command (gitlens.showQuickCommitFileDetails
) to show a quick pick menu to explore a file of a commit and take action upon it
Quick Stash Access
- Adds a Show Stashes command (
gitlens.showQuickStashList
) to show a quick pick menu to explore your stashes
Quick Status Access
- Adds a Show Repository Status command (
gitlens.showQuickRepoStatus
) to show a quick pick menu to for visualizing the current repository status
Interactive Rebase Editor
Adds a user-friendly interactive rebase editor to more easily configure an interactive rebase session
- Quickly re-order, edit, squash, and drop commits
- Includes drag & drop support!
To use this directly from your terminal, e.g. when running git rebase -i
:
- set VS Code as your default Git editor
git config --global core.editor "code --wait"
- or, to only affect rebase, set VS Code as your Git rebase editor
git config --global sequence.editor "code --wait"
To use the Insiders edition of VS Code, replace code
in the above with code-insiders
Autolinks
Use autolinks to linkify external references, like Jira issues or Zendesk tickets, in commit messages.
Terminal Links
- Optionally adds autolinks for branches, tags, and commit ranges in the integrated terminal to quickly explore their commit history
- Optionally adds autolinks for commits in the integrated terminal to quickly explore the commit and take action upon it
Remote Provider Integrations
GitLens provides rich integrations with many remote providers, including GitHub, GitHub Enterprise, GitLab, Gitea, Gerrit, Bitbucket, Bitbucket Server, and Azure DevOps. You can also define custom remote providers or remote providers with custom domains as well.
Basic integrations provide issue and pull request auto-linking, while richer integrations (e.g. GitHub) can provide rich hover information provided for auto-linked issues and pull requests, associate pull requests with branches and commits, and provide avatars.
Additionally, these integrations provide commands to copy the url of or open, files, commits, branches, and the repository on the remote provider.
- Open File from Remote command (
gitlens.openFileFromRemote
) — opens the local file from a url of a file on a remote provider - Open File on Remote command (
gitlens.openFileOnRemote
) — opens a file or revision on the remote provider - Copy Remote File Url command (
gitlens.copyRemoteFileUrlToClipboard
) — copies the url of a file or revision on the remote provider - Open File on Remote From… command (
gitlens.openFileOnRemoteFrom
) — opens a file or revision on a specific branch or tag on the remote provider - Copy Remote File Url From… command (
gitlens.copyRemoteFileUrlFrom
) — copies the url of a file or revision on a specific branch or tag the remote provider - Open Commit on Remote command (
gitlens.openCommitOnRemote
) — opens a commit on the remote provider - Copy Remote Commit Url command (
gitlens.copyRemoteCommitUrl
) — copies the url of a commit on the remote provider - Open Branch on Remote command (
gitlens.openBranchOnRemote
) — opens the branch on the remote provider - Copy Remote Branch Url command (
gitlens.copyRemoteBranchUrl
) — copies the url of a branch on the remote provider - Open Branches on Remote command (
gitlens.openBranchesOnRemote
) — opens the branches on the remote provider - Copy Remote Branches Url command (
gitlens.copyRemoteBranchesUrl
) — copies the url of the branches on the remote provider - Open Comparison on Remote command (
gitlens.openComparisonOnRemote
) — opens the comparison on the remote provider - Copy Remote Comparison Url command (
gitlens.copyRemoteComparisonUrl
) — copies the url of the comparison on the remote provider - Open Pull Request command (
gitlens.openPullRequestOnRemote
) — opens the pull request on the remote provider - Copy Pull Request Url command (
gitlens.copyRemotePullRequestUrl
) — copies the url of the pull request on the remote provider - Open Repository on Remote command (
gitlens.openRepoOnRemote
) — opens the repository on the remote provider - Copy Remote Repository Url command (
gitlens.copyRemoteRepositoryUrl
) — copies the url of the repository on the remote provider
Connecting the GitHub Integration
To connect the GitHub integration, open a GitHub.com repository in Visual Studio Code. Then, select a file and hover over the line blame to get the details hover. From here, select Connect to GitHub
.
If you are prompted to sign in using GitHub, select Allow
.
Finally, you will be taken to a browser where you will be prompted to sign into GitHub and Authorize Visual-Studio-Code
to finish connecting.
Connecting the GitLab Integration
To connect the GitLab integration, open a GitLab.com repository in Visual Studio Code. Then, select a file and hover over the line blame to get the details hover. From here, select the option to Connect to GitLab
.
Next, you will be prompted to provide a Personal Access Token from GitLab.com. If you do not have one already with the required scopes, follow these instructions to create one. The required scopes for the token are read_api
, read_user
, and read_repository
. Once you have your token, copy and paste it into the prompt and hit Enter
to finish connecting.
GitHub Enterprise and GitLab Self-Managed Integration ✨
GitLens Pro offers a richer integration with GitHub Enterprise and GitLab Self-Managed.
Once authenticated, GitLens will enrich GitHub Enterprise or GitLab Self-Managed autolinks in the hovers. You’ll see your GitHub Enterprise or GitLab Self-Managed avatar, links to related pull requests, along with a footnote of the pull request or issue details. You’ll see similar details from the Sidebar views for any commit or branch associated with a pull request or issue.
See the remote provider integration settings to configure these integrations.
Powerful Commands
-
Adds an Add Co-authors command (
gitlens.addAuthors
) to add a co-author to the commit message input box -
Adds a Copy SHA command (
gitlens.copyShaToClipboard
) to copy the commit SHA of the current line to the clipboard or from the most recent commit to the current branch, if there is no current editor -
Adds a Copy Message command (
gitlens.copyMessageToClipboard
) to copy the commit message of the current line to the clipboard or from the most recent commit to the current branch, if there is no current editor -
Adds a Copy Current Branch command (
gitlens.copyCurrentBranch
) to copy the name of the current branch to the clipboard -
Adds a Switch to Another Branch (
gitlens.views.switchToAnotherBranch
) command — to quickly switch the current branch -
Adds a Compare References… command (
gitlens.compareWith
) to compare two selected references -
Adds a Compare HEAD with… command (
gitlens.compareHeadWith
) to compare the index (HEAD) with the selected reference -
Adds a Compare Working Tree with… command (
gitlens.compareWorkingWith
) to compare the working tree with the selected reference -
Adds an Open Changes (difftool) command (
gitlens.externalDiff
) to open the changes of a file or set of files with the configured git difftool -
Adds an Open All Changes (difftool) command (
gitlens.externalDiffAll
) to open all working changes with the configured git difftool -
Adds an Open Directory Compare (difftool) command (
gitlens.diffDirectoryWithHead
) to compare the working tree with HEAD with the configured Git difftool -
Adds an Open Directory Compare (difftool) with… command (
gitlens.diffDirectory
) to compare the working tree with the selected reference with the configured Git difftool -
Adds an Open File command (
gitlens.openWorkingFile
) to open the working file for the current file revision -
Adds an Open Revision… command (
gitlens.openFileRevision
) to open the selected revision for the current file -
Adds an Open Revision from… command (
gitlens.openFileRevisionFrom
) to open the revision of the current file from the selected reference -
Adds an Open Blame Prior to Change command (
gitlens.openBlamePriorToChange
) to open the blame of prior revision of the selected line in the current file -
Adds a Open Changed Files command (
gitlens.openChangedFiles
) to open any files with working tree changes -
Adds a Close Unchanged Files command (
gitlens.closeUnchangedFiles
) to close any files without working tree changes -
Adds an Enable Debug Logging command (
gitlens.enableDebugLogging
) to enable debug logging to the GitLens output channel -
Adds a Disable Debug Logging command (
gitlens.disableDebugLogging
) to disable debug logging to the GitLens output channel
Menus & Toolbars
GitLens provides customizable menu and toolbar contributions to put you in control over where GitLens’ commands are shown. The easiest way to configure these settings is via the GitLens interactive settings editor.
For example, if you uncheck the Add to the editor group toolbar you will see the following items removed from the toolbar:
You can also expand each group to control each area more granularly.
Modes
GitLens supports user-defined modes for quickly toggling between sets of settings.
- Adds the active mode to the status bar (optional, on by default)
- Adds Toggle Review Mode command (
gitlens.toggleReviewMode
) to toggle Review mode
- Adds Toggle Review Mode command (
- Adds Switch Mode command (
gitlens.switchMode
) to quickly switch the active mode - Adds a Zen mode which for a zen-like experience, disables many visual features
- Adds Toggle Zen Mode command (
gitlens.toggleZenMode
) to toggle Zen mode
- Adds Toggle Zen Mode command (
- Adds a Review mode which for reviewing code, enables many visual features