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

change the filetype from binary to text after the file is commited to a git repo

From
TTtonka tonka <tonka3100@gmail.com>
Date
Jul 24, 2017, 05:11 UTC
Message-ID
<CAEor4NHDNL4CQP_FpCuJ_3F86-A3P8i=yvp1AZr-NKt0i1=cXw@mail.gmail.com>
Hey everybody,

I have a problem with an already committed file into my repo. This git repo was converted from svn to git some years ago. Last week I have change some lines in a file and I saw in the diff that it is marked as binary (it's a simple .cpp file). I think on the first commit it was detected as an utf-16 file (on windows). But no matter what I do I can't get it back to a "normal text" text file (git does not detect that), but I is now only utf-8. I also replace the whole content of the file with just 'a' and git say it's binary.

Is the only way to get it back to text-mode?:
* copy a utf-8 version of the original file
* delete the file
* make a commit
* add the old file as a new one
I think that will work but it will also break my history.
Is there a better way to get these behavior without losing history?

Best regards Tonka

Next: Jeff King
Message 1 of 6 in “change the filetype from binary to text after the file is commited to a git repo”
  1. tonka tonkaJul 24, 2017
  2. Jeff KingJul 24, 2017
  3. tonka3100@gmail.comJul 24, 2017
  4. Jeff KingJul 24, 2017
  5. Jeff KingJul 24, 2017
  6. tonka3100@gmail.comJul 24, 2017

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.