vscode-gitlens icon indicating copy to clipboard operation
vscode-gitlens copied to clipboard

Add setting to hide untracked files in Search & Compare view when comparing with Working Tree

Open herquan-docusign opened this issue 6 months ago • 3 comments

Description

Problem

When using the Search & Compare view (in GitLens Inspect) to compare a branch with the Working Tree, untracked files are always shown in the "files changed" list. There is no setting to hide them.

GitLens hardcodes includeUntracked: true when comparing with the working tree. The getUntrackedFiles() method calls git ls-files --others --exclude-standard and the results are always merged into the comparison file list (in getDiffStatus and getChangedFilesCount).

The VS Code built-in setting git.untrackedChanges does not affect GitLens views.

Proposed solution

Add a setting such as gitlens.views.searchAndCompare.includeUntracked (default: true) that controls whether untracked files are included when comparing with the Working Tree in the Search & Compare view. Ideally this could also be toggled via a context menu action on the comparison result node, similar to the existing setResultsFilesFilterOnLeft / setResultsFilesFilterOnRight / setResultsFilesFilterOff commands.

Current workaround

The only workaround is to add files to exclude or .gitignore, which is not ideal since it changes git behavior globally for the repo rather than just controlling the GitLens UI.

Environment

  • GitLens Version: 18.0.0
  • Git Version: git version 2.50.0.windows.1

herquan-docusign avatar May 28 '26 18:05 herquan-docusign

I encountered the same issue, so I downgraded the version.

xidianzhangjun avatar Jun 02 '26 04:06 xidianzhangjun

Has this issue been fixed in the latest version? Thanks!

xidianzhangjun avatar Jun 26 '26 08:06 xidianzhangjun

Has this issue been fixed in the latest version? Thanks!

I don't see it fixed.

herquan-docusign avatar Aug 12 '26 05:08 herquan-docusign