hhh
hhh

Reputation: 52840

Git grep over all commits in all braches and open up in a pager?

I am able to grep over all branches, as suggested here, but I want to open the results in a pager such as vim. Failing:

git grep -Ovim <regexp> $(git rev-list --all)

which works without the need to go over all commits with $(git rev-list --all).

How can I grep over all commits in all branches and open up the results in a pager such as vim?

Upvotes: 0

Views: 116

Answers (1)

Kent
Kent

Reputation: 195059

If you want to use the open file in pager function, you cannot across branches. It works only on the worktree.

But if you want to open the grep result in vim, it is easy:

git grep ... $(git rev-list --all)|vim -

You may want to tweak your grep option to suppress the color output.

Upvotes: 2

Related Questions