View source control history

Source control history helps you understand how a codebase changed, which commits affected a file, and who last changed a line. VS Code provides the Source Control Graph for repository history, the Timeline view for file history, and Git blame information for individual lines.

View branch and commit history

The Source Control Graph in the Source Control view (⌃⇧G (Windows, Linux Ctrl+Shift+G)) shows your commit history and branch relationships. When your branch has an upstream branch, the graph also identifies incoming and outgoing commits.

Screenshot showing the Source Control Graph with commits and branch relationships.

Use the graph to:

  • Select a commit to view the files that changed.
  • Select a changed file to open its diff.
  • Select Open Changes to review all changes in a commit.
  • Open the context menu for a commit to check it out, cherry-pick it, or add it as context to chat.
  • Compare a commit with another branch, a remote branch, or its merge base.

Use the graph toolbar to select a branch and to fetch, pull, push, or sync changes.

Understand incoming and outgoing commits

The graph identifies commits that differ between your current branch and its upstream branch:

  • Incoming commits are available on the remote and have not been pulled.
  • Outgoing commits exist locally and have not been pushed.

Use the scm.graph.showIncomingChanges Open in VS Code Open in VS Code Insiders and scm.graph.showOutgoingChanges Open in VS Code Open in VS Code Insiders settings to control whether these commits appear. Use the scm.graph.pageSize Open in VS Code Open in VS Code Insiders setting to configure how many commits the graph initially loads.

View file history with the Timeline view

The Timeline view shows events for the file that is active in the editor. These events can include Git commits and local file saves.

  1. Open a file in the editor.

  2. In the Explorer view (⇧⌘E (Windows, Linux Ctrl+Shift+E)), expand the Timeline view.

  3. Select an event to inspect the corresponding file changes.

Screenshot showing Git commits and local file saves in the Timeline view.

Use the Timeline filter to show only Git commits or to include events from other timeline providers. Learn more about the Timeline view.

View Git blame information

Git blame information identifies the commit and author that last changed a line. VS Code can show this information in the editor and in the Status Bar.

Use the Git: Toggle Git Blame Editor Decoration and Git: Toggle Git Blame Status Bar Item commands to show or hide blame information. You can also configure these settings:

  • git.blame.statusBarItem.enabled Open in VS Code Open in VS Code Insiders : shows blame information in the Status Bar.
  • git.blame.editorDecoration.enabled Open in VS Code Open in VS Code Insiders : shows blame information inline in the editor.
  • git.blame.editorDecoration.disableHover Open in VS Code Open in VS Code Insiders : hides the blame hover in the editor.
  • git.blame.ignoreWhitespace Open in VS Code Open in VS Code Insiders : ignores whitespace changes when Git determines line authorship.

Hover over a blame decoration to view commit details, including co-author trailers. If VS Code adds AI co-author attribution to a commit, the blame hover includes that attribution.

Customize blame information

Use the git.blame.editorDecoration.template Open in VS Code Open in VS Code Insiders and git.blame.statusBarItem.template Open in VS Code Open in VS Code Insiders settings to choose which commit details appear.

For example, the following template shows the commit subject, author name, and relative author date:

{
  "git.blame.editorDecoration.template": "${subject}, ${authorName} (${authorDateAgo})"
}

Use the git.blame.editorDecorationForeground theme color to change the color of inline blame information.

Next steps