J. Hesters
J. Hesters

Reputation: 14816

How to search for a string in old git changes in VSCode?

I'm working on a branch rewriting some code in VSCode. (I have the plugin GitLens installed.) I'm rewriting this one function - let's call it foo - and I'm trying to understand where it has been used before.

Is there a way to search for something in the modified / deleted changes in Git using VSCode? I mean like pressing cmd + shift + f and then typing the word so you get highlights in all current git changes?

Upvotes: 13

Views: 5178

Answers (2)

Chizaram Nwazuo
Chizaram Nwazuo

Reputation: 11

If you have the gitlens extension, you can use the command pallette (Ctrl/Cmd + Shift + p) and search for 'Search commits'. This should show an input for you to search for commits by message, hash, etc.

Open command palette Open command palette

Search by commit(gitlens) Search by commit(gitlens)

Upvotes: 1

ozkanpakdil
ozkanpakdil

Reputation: 4622

In gitlens left bottom you can see "SEARCH COMMITS" there you can search in change or commit messages

SEARCH COMMITS

here is example result when I search class in mvn project

search class keyword

When I search a function name it also finds

Search function name

Upvotes: 13

Related Questions