# git cat-file blob does not convert crlf

3 messages from 2008-11-26 to 2008-11-27. Participants: Quim K. Holland, Junio C Hamano, Johannes Schindelin.
Thread: https://gitlist.dev/t/16481

## Quim K. Holland, 2008-11-26 19:34

Subject: git cat-file blob does not convert crlf
Message-ID: <20081127013456.6117@qkholland.gmail.com>
URL: https://gitlist.dev/e/20081127013456.6117%40qkholland.gmail.com

```
I think git is buggy.
I wanted to discard the changes I made to my file by checking out a copy from the last commit, so I said
% git cat-file blob HEAD:my-file >my-file
But this does not respect core.autocrlf and the file becomes one long line.
Also it feels stupid that I have to say my-file twice at the command prompt.

```

## Junio C Hamano, 2008-11-26 19:42

Subject: Re: git cat-file blob does not convert crlf
Message-ID: <7v3ahegtpi.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v3ahegtpi.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <20081127013456.6117@qkholland.gmail.com>

```
"Quim K. Holland" <qkholland@gmail.com> writes:

> I think git is buggy.

Thanks for pointing it out X-<.

> I wanted to discard the changes I made to my file by checking out a copy from the last commit, so I said
> % git cat-file blob HEAD:my-file >my-file
> But this does not respect core.autocrlf and the file becomes one long line.

That is pretty much intentional.  cat-file is a low-level command that is
meant to inspect the raw object contents.  The output from the command has
to be reproducible regardless of what customization you have in your
particular repository and omission of attributes support (including the
crlf conversion) is quite deliberate.

You said that you wanted to discard the changes by checking out a copy out
of the HEAD commit.  This can literally be done by:

	$ git checkout HEAD my-file

If you want to check out a copy out of the index (i.e, "the last staged
version"), you can say:

	$ git checkout my-file

In other words, if you want to checkout, you can say checkout ;-)

```

## Johannes Schindelin, 2008-11-27 01:41

Subject: Re: git cat-file blob does not convert crlf
Message-ID: <alpine.DEB.1.00.0811270241060.30769@pacific.mpi-cbg.de>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0811270241060.30769%40pacific.mpi-cbg.de
In-Reply-To: <20081127013456.6117@qkholland.gmail.com>

```
Hi,

On Thu, 27 Nov 2008, Quim K. Holland wrote:

> I think git is buggy.

You probably missed the difference between porcelain and plumbing.  Git is 
not buggy.

Ciao,
Dscho

```
