Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grep full history #127

Closed
borekb opened this issue Aug 3, 2017 · 6 comments
Closed

Grep full history #127

borekb opened this issue Aug 3, 2017 · 6 comments
Assignees
Labels
feature New feature or request

Comments

@borekb
Copy link

borekb commented Aug 3, 2017

It would be nice to be able to grep the full Git history. I'm not sure how to best do it but these Git commands provide close to what I would be after:

$ git log -S"search string"
$ git log -G"search\ string"
$ git rev-list --all | xargs git grep "search string"

Some related Stack Overflow QAs:

@eamodio eamodio added feature New feature or request help wanted Want community input and/or pull request labels Aug 7, 2017
@eamodio eamodio added this to the Backlog milestone Aug 7, 2017
eamodio added a commit that referenced this issue Oct 21, 2017
Adds ~ to search for changes
Adds = to search for changes with new occurrences only
@eamodio eamodio self-assigned this Oct 21, 2017
@eamodio eamodio modified the milestones: Backlog, Soon™ Oct 21, 2017
@eamodio eamodio added pending-release Resolved but not yet released to the stable edition and removed help wanted Want community input and/or pull request labels Oct 21, 2017
@eamodio
Copy link
Member

eamodio commented Oct 25, 2017

@borekb can you try out the latest GitLens v6 alpha? I've implemented the first two and I don't think I can implement the last (since xargs isn't platform agnostic)

Please follow these instructions to install a pre-release. Let me know if you experience any issues -- thanks!

@borekb
Copy link
Author

borekb commented Oct 26, 2017

Nice! I tried it and it worked great. Some feedback:

  1. The "hint" text in the search field should be updated with the info about ~ (and maybe also =; what's the difference between the two?)

image

  1. I wonder if there could be a better way to preview the change with my search string. Say that I search for "unicorn", it finds all commits with "unicorn" fine but each commit is a long list of files and it's hard to tell in which the change happened.

I don't have a good suggestion, maybe the search could open a sidebar and clicking a commit there would open a diff editor with the change, I really don't know, but as "v1" of this feature, I'm already happy what it does. Thank you!

@eamodio
Copy link
Member

eamodio commented Nov 9, 2017

As the hint text is already so long, I didn't want to try to squeeze in the new search options.

As for the search results in another view if you feel that this is needed please open a new issue specifically for that.

Thanks!

@eamodio eamodio closed this as completed Nov 9, 2017
@eamodio eamodio removed the pending-release Resolved but not yet released to the stable edition label Nov 9, 2017
@borekb
Copy link
Author

borekb commented Nov 9, 2017

Thanks. I still wonder how <message>, ~<regex> and =<regex> differ? Maybe pointers to Git documentation would be useful in the README.

@eamodio
Copy link
Member

eamodio commented Nov 9, 2017

I will add the following to the README

  • Adds a Search Commits command (gitlens.showCommitSearch) with a shortcut of alt+/ to search for commits by message, author, file(s), commit id, or code changes
    • Use <message> to search for commits with messages that match <message> -- See Git docs
    • Use @<name> to search for commits with authors that match <name> -- See Git docs
    • Use :<pattern> to search for commits with file names that match <pattern> -- See Git docs
    • Use #<sha> to search for a commit with id of <sha> -- See Git docs
    • Use ~<regex> to search for commits with differences whose patch text contains added/removed lines that match <regex> -- See Git docs
    • Use =<regex> to search for commits with differences that change the number of occurrences of the specified string (i.e. addition/deletion) in a file -- See Git docs

billsedison added a commit to tmobile/vscode-gitlens-enhanced that referenced this issue Mar 2, 2019
Added missing images from the original repository
@eamodio eamodio removed this from the Soon™ milestone Jul 19, 2019
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants