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

Request to add helm-git-grep #2162

Closed
kvaneesh opened this issue Jul 2, 2015 · 6 comments
Closed

Request to add helm-git-grep #2162

kvaneesh opened this issue Jul 2, 2015 · 6 comments
Labels

Comments

@kvaneesh
Copy link

kvaneesh commented Jul 2, 2015

Can we get helm-git-grep added to the layer ?

@syl20bnr
Copy link
Owner

syl20bnr commented Jul 4, 2015

What are the advantages of git-grep over ag and pt ?

@kvaneesh
Copy link
Author

kvaneesh commented Jul 4, 2015

I have never used ag or pt. I always found git-grep to be faster than grep and it grep only git tracked files.

@tvon
Copy link

tvon commented Sep 12, 2015

@syl20bnr It depends on what you want to do, but git grep understands the world of git so you can search across more than what is currently checked out, e.g. you can search a different branch or a collection of commits. As a semi-contrived example, if you wrote something in branch-a that is relevant to what you're doing in branch-b you can run git grep "whatever code" branch-a to find the relevant content while you have the same file open in branch-b.

Also, I think @kvaneesh hit the key point that git grep will (by default) search only and all tracked text files which is a significant distinction. For example, ag and pt ignore hidden files by default, while git grep will search them if they are tracked by git. I mean, if a file is tracked by git then it is significant to a project, and when I'm searching in a project I want the target of that search to be the files that are significant to the project.

In the end it depends on what you are trying to do, but it seems to me that if git is used to manage a particular directory tree then it makes sense to use git to do searches within that directory tree.

@pesterhazy
Copy link
Contributor

Agree with @kvaneesh, I find git grep to be the most useful of all search tools if you're looking for files in the project under version control. As an example, a string may occur in (git-ignored) log files, cluttering up the search results.

@pesterhazy
Copy link
Contributor

I just learned that projectile will use git grep instead of grep if you set the variable

(projectile-use-git-grep t)

You can use <SPC> : customize-variable for this.

If you also set spacemac's search tools to just "grep",

dotspacemacs-search-tools '("grep")

<SPC> s p and <SPC> / will use git grep if in a git project.

@StreakyCobra
Copy link
Contributor

I just tried @pesterhazy's solution and it's working.

It's not literally answering the initial question, which was about helm using git-grep, not only projectile, but in practice it's answering it: As git-grep is useless if used outside of a git repository, and that projectile can be used in every git repository, it's covering all use case.

As it's solved, I'm closing the issue, but feel free to open a new one in case of troubles ☺️

Domon added a commit to Domon/dotfiles that referenced this issue Apr 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants