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

Re: core.safecrlf warning is confusing[improvement suggestion?]

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 22, 2017, 02:01 UTC
Message-ID
<xmqqine3xea5.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20171121161824.GA13548@tor.lan>
Torsten Bögershausen <tboegi@web.de> writes:
Show 6 quoted lines
>> I want to have LF line endings in the repository and CRLF endings in
>> the working copy. (Because I use windows-exclusive tools to develop.)
>
> Side note: If you ever want to push your repository somewhere,
> it would be good practice to have a .gitattributes file:
> ...
Now we got your attention ;-)

What would be the BCP we would give if somebody has just a tarball without .git that has LF endings?

    $ git init a-project
    $ cd a-project
    $ tar xf ../a-project.tar
    $ git add .
    $ git commit -m 'Initial import'

would achieve one half of the original wish (i.e. "I want to end up with repository data in LF eol"); disabling the "safe crlf" before running that "git add ." step may also not be a bad idea, because it reduces the number of things that can get in the way by one.

But the above also leaves the "working tree" files in LF eol (i.e. it goes against "I want to work with CRLF in my working tree"). What would be our recommendation?

One big-hammer way I can think of is
    $ git rm -f .
    $ git reset --hard

and that actually may be a good enough solution, given that you'd be doing this just once at the beginning of "your" project that starts from an inherited code drop.

Previous: Torsten BögershausenNext: Torsten Bögershausen
Message 5 of 6 in “core.safecrlf warning is confusing[improvement suggestion?]”
  1. Vladimir NikishkinNov 21, 2017
  2. Junio C HamanoNov 21, 2017
  3. Junio C HamanoNov 21, 2017
  4. Torsten BögershausenNov 21, 2017
  5. Junio C HamanoNov 22, 2017
  6. Torsten BögershausenNov 22, 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.