I had the same problem when I want to grep my
.bash_history. (Little Note: I renamed my history, so that a new one was created. This new history was not treated as a binary.)
In @heemayls answer it is stated, that
grep takes filenames and
cat would be useless. This is not entirely true.
greps man page:
If no files are specified, or if the file “-” is given, grep searches standard input.
So you could use
cat and pipe it to
grep. However this solves not the problem that
.bash_history is treated as a binary. The only right thing is to use
grep -a (Like in the answer from @AK_) whether you
grep the history directly or with
cat and a pipe.
cat .bash_history | grep -a git
grep -a git .bash_history