Scripts2026年7月6日·1 分钟阅读

GitLens — Supercharge Git in Visual Studio Code

A VS Code extension that adds inline Git blame, rich commit history, visual file comparisons, interactive rebase, and deep repository exploration to the editor.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
GitLens
直接安装命令
npx -y tokrepo@latest install bab31084-7937-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

Introduction

GitLens is a VS Code extension that enhances the built-in Git capabilities with inline blame annotations, rich commit details, visual file history, and powerful repository navigation. It surfaces the context behind every line of code directly in the editor without leaving your workflow.

What GitLens Does

  • Shows inline blame annotations on the current line with author, date, and commit message
  • Provides a sidebar view with file history, branch comparisons, and contributor details
  • Enables visual file and line diffs between any commits, branches, or tags
  • Offers an interactive rebase editor for reordering, squashing, and editing commits
  • Includes a commit graph for visualizing branch topology and merge history

Architecture Overview

GitLens runs as a VS Code extension that interfaces with the local Git binary through the VS Code Git API and direct process spawning. It decorates editors with blame data fetched from git log and git blame commands, caches results for performance, and renders them through VS Code's decoration and webview APIs. The commit graph and history views use webview panels with custom rendering.

Self-Hosting & Configuration

  • Install from the VS Code Marketplace or download the VSIX for offline installation
  • Core features (blame, history, diff) work with no configuration on any Git repository
  • Customize which annotations appear via Settings -> GitLens -> Current Line Blame
  • Configure code lens settings to show recent changes and authors above functions
  • Advanced features like the visual commit graph are available in the free tier

Key Features

  • Current line blame shows who changed each line and when, inline as you navigate
  • File annotations toggle between blame, changes, and heatmap views for the entire file
  • Revision navigation lets you step through a file's history version by version
  • Worktrees view manages multiple Git worktrees from the sidebar
  • Deep linking generates shareable URLs to specific lines at specific commits

Comparison with Similar Tools

  • Git Blame (built-in) — VS Code's native blame is basic; GitLens adds rich context and navigation
  • Git History — extension focused on log viewing; GitLens covers blame, history, and more
  • GitHub Pull Requests — extension for PR review; GitLens focuses on local repository context
  • tig — terminal-based Git browser; GitLens integrates the same insights into the VS Code UI
  • Magit (Emacs) — powerful Git porcelain for Emacs; GitLens is the VS Code equivalent in scope

FAQ

Q: Is GitLens free? A: Yes. Core features including blame, history, diffs, and the commit graph are free for all repositories. Some advanced features require a Pro subscription for private repos.

Q: Does GitLens slow down VS Code? A: GitLens is designed to be lightweight. Blame data is fetched lazily and cached. If you experience slowness on very large repos, disable code lens or reduce annotation frequency.

Q: Can I use GitLens with GitHub, GitLab, or Bitbucket? A: Yes. GitLens integrates with remote hosting services for deep linking, avatar fetching, and issue references.

Q: How do I disable inline blame temporarily? A: Toggle it with the command palette: GitLens: Toggle Line Blame, or use the status bar indicator.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产