Last active
August 29, 2015 14:06
-
-
Save dvdasari/ac6369d8653a2a7b3eca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ruby gitsearch.rb | |
search_term = "elasticsearch" | |
file_types = "*.rb" | |
`echo "\n############################" >> search_results.txt` | |
`echo "Search Term: #{search_term}" >> search_results.txt` | |
`echo "File Types: #{file_types}" >> search_results.txt` | |
`echo "############################\n" >> search_results.txt` | |
git_branches = `git branch`.split | |
git_branches.delete('*') | |
git_branches.each_with_index do |branch_name, ind| | |
puts "\n#{ind + 1 } branch_name: #{branch_name}" | |
print `git grep -e #{search_term} #{branch_name} -- '#{file_types}'` | |
`git grep -e #{search_term} #{branch_name} -- '#{file_types}' >> search_results.txt` | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment