git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git list binary and/or non-binary files?

From
Johan Herland <johan@herland.net>
Date
Aug 24, 2009, 22:14 UTC
Message-ID
<200908250014.03585.johan@herland.net>
In-Reply-To
<2729632a0908241450m1651c77ata9744058c5d42672@mail.gmail.com>
On Monday 24 August 2009, skillzero@gmail.com wrote:
Show 11 quoted lines
> Is there a way to list the files git considers binary in a repository
> (and alternatively, the ones it considers text)? I have a large
> repository and I want to fix line endings for text files that were
> accidentally checked in using CRLF and can't just use the file
> extension alone because some files with the same extension may be
> binary and others not (e.g. UTF-8 .strings file is text, but a UTF-16
> .strings file is binary...git already figured out based on the content
> that one is binary).
>
> I thought maybe git ls-files, but I didn't see anything in there I can
> use for binary vs text.

I use the following to list files that contain CRs, but that are not considered binary by Git:

  git grep --cached -I -l -e $'\r'
'git help grep' explains all the options...
Have fun! :)
...Johan
-- 
Johan Herland, <johan@herland.net>
www.herland.net
Previous: skillzero@gmail.comNext: skillzero@gmail.com
Message 2 of 3 in “git list binary and/or non-binary files?”
  1. skillzero@gmail.comAug 24, 2009
  2. Johan HerlandAug 24, 2009
  3. skillzero@gmail.comAug 24, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.