gitk search results

1.8k views Asked by At

I have tried gitk $(git log -S" extreemly rare " --pretty=format:%h), as this answer suggests but gitk shows all commits in addition to the search results (if I can add anything to a universal set)

Initially, this came from this answer, that recommended gitk --all $(git log -S" rare text" --pretty=format:%h). I was advised to remove --all but this does not have any effect.

2

There are 2 answers

3
patthoyts On BEST ANSWER

gitk typically can accept all the arguments you might give to git log. So for your case, gitk -S" extremely rare " should show just the commits (plus their immediate parent) that match.

It is equivalent to using the edit view dialog and entering your query into the "Search string" entry field.

4
twalberg On

Because gitk --all includes all branch heads, after which you're (maybe) adding a few more things to include. So the end result is for gitk to show you everything that's currently reachable from any branch head, including the (possibly empty) set of search results.

In the link you cite, what is being added to the --all is a set of dangling commits (i.e. not reachable by any branch head), so the end result is to add more than what gitk --all would show, not limit it.