Git Project Tree
A VS Code view that shows the whole project tree, like Visual Studio's Solution Explorer, and highlights the files that changed in Git.
Unlike the Source Control view, which lists only changed files, every file and folder of the workspace is shown in place, with the Git status next to it.
Features
Full project tree in its own Activity Bar view. Folders are read only when expanded, so large projects stay fast.
Git status badges in the theme's Git colors:
| Badge |
Meaning |
M |
Modified |
A |
Added |
D |
Deleted (the file stays in the tree, marked "deleted") |
R |
Renamed (the tooltip gives the old name) |
U |
Untracked |
! |
Merge conflict |
| dimmed |
Ignored |
Staged and unstaged changes are kept apart. The tooltip always lists both. With statusMode: separate, the badge shows both sides like git status -s (M· staged, ·M unstaged, MM both).
Folders containing changes are colored. Their tooltip gives the number of changed files.
Actions in the context menu and inline buttons, on files, folders and multi-selections:
- Open File.
- Open Changes: HEAD ↔ Index for staged changes, Index (or HEAD) ↔ Working Tree for unstaged changes.
- Open Staged Changes and Open Unstaged Changes separately, when a file has both.
- Stage, Unstage.
- Discard Changes. It always asks first. Staged changes are kept. Untracked files are deleted permanently, and the confirmation says so.
- Reveal in Explorer View, Reveal in Source Control.
Toolbar: Refresh, and a toggle between all folders and only folders with changes.
Multi-root workspaces, several repositories, nested repositories and submodules. Each file is matched to its own repository, and the branch name is shown on repository roots.
Automatic refresh from Git events (stage, commit, checkout, merge, pull…) and file system events. Refreshes are debounced, the expansion state is kept, and only the affected items are updated.
Settings
| Setting |
Default |
Description |
gitProjectTree.sortOrder |
foldersFirst |
foldersFirst, filesFirst or mixed; names are sorted naturally |
gitProjectTree.statusMode |
consolidated |
One letter, or staged + unstaged (separate) |
gitProjectTree.folderDecorations |
true |
Color folders that contain changes |
gitProjectTree.showUnchangedFolders |
true |
Off: only show folders that contain changes |
gitProjectTree.showIgnored |
true |
Show ignored files dimmed; off hides them |
gitProjectTree.exclude |
.git, node_modules, bin, obj |
Glob patterns to hide |
gitProjectTree.useFilesExclude |
true |
Also hide what files.exclude hides |
gitProjectTree.autoRefresh |
true |
Off: update only with the Refresh button |
Requirements and limitations
- Uses the built-in Git extension (
vscode.git) and its public API. The extension never runs the git CLI itself. When Git is missing or disabled, the tree is still shown, without status, and the view says why.
- Ignored files come from the API's
checkIgnore, asked once per expanded folder. Changes to a global excludes file are picked up with Refresh.
- An unstaged rename is reported by Git as a deletion plus an untracked file. It only shows as
R once staged.
- Reveal in Source Control focuses the Source Control view and opens the change. VS Code has no public API to select an item in that view.
- With
git.untrackedChanges: hidden, the Git extension does not report untracked files, so they are not marked.
Development
npm install
npm test # unit tests
npm run test:integration # VS Code integration tests on temporary repositories
npm run package # builds the .vsix
The integration tests download a VS Code build into .vscode-test/. Alternatively, set VSCODE_TEST_EXECUTABLE to the Code.exe of an installed VS Code; that only works while no other instance of that VS Code is running.
Press F5 to start an Extension Development Host.
License
MIT. src/git/git.d.ts is copied from microsoft/vscode (MIT).
| |