Michael Allen Smith
Michael Allen Smith

Reputation: 89

VS Code - search only the current active git branch?

When I use the search on VS Code, it searches all the git branches I have. Is there a way to only search the current active git branch?

Upvotes: -1

Views: 1699

Answers (2)

user2366286
user2366286

Reputation: 1

I have the same situation.

The search pane shows the filename with commit number added:

Search pane

When I click on а search result, the title of opened tab contains the filename and the commit number also:

Code editor

I have noticed that searching a keyword from a code editor opened for comparing a file from different branches, searches in that branches also.

Searching for a keyword from a code editor when the opened file is from the HEAD, the search results are only from the HEAD, so the above results does not appear.

Upvotes: 0

VonC
VonC

Reputation: 1324947

The VSCode search across file allows you to quickly search over all files in the currently opened folder, with Ctrl+Shift+F.

https://code.visualstudio.com/assets/docs/editor/codebasics/search.png

Only the file currently available in your workspace (which can be your Git cloned repository working tree) are searched.

Upvotes: 4

Related Questions