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?
File extensions We can usually tell if a file is binary or text based on its file extension. This is because by convention the extension reflects the file format, and it is ultimately the file format that dictates whether the file data is binary or text.
This occurs because: SQL files contain a Byte Order Mark (BOM), this is the 0xFEFF sequence you're seeing at the start of the file. Unfortunately these bytes means git treats the file as binary, not text, and so any operations that depend on git, such as generating a diff, aren't going to return what you expect.
Git LFS is a Git extension used to manage large files and binary files in a separate Git repository. Most projects today have both code and binary assets. And storing large binary files in Git repositories can be a bottleneck for Git users. That's why some Git users add Git Large File Storage (LFS).
txt is created and the mode set to bw so that bytes can be written into the file, making it a binary file.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With