Andorbal
Andorbal

Reputation: 880

Tell git that a text file is actually binary

I committed a few PDF files into a git repository and it looks like git treated it as text and not binary. So what's in the repo is almost 1k larger than the source and no longer displays correctly.

I updated my .gitattributes file to include PDF files as binary, but the damage already seems to be done on the files in the repo. Is there any way to tell git to re-add the PDFs as binary? Would be best solution be to remove the files from the repo and re-add them?

Upvotes: 7

Views: 594

Answers (1)

Pascal Belloncle
Pascal Belloncle

Reputation: 11389

yes, remove and add back should work.

Committing a new version on top after you've added the .gitattributes file should be enough. The removing step should not be required.

Upvotes: 4

Related Questions