Search code examples
git-lfs

How to store Pixelmator files (macOS bundle) to git LFS?


I'm trying to store Pixelmator files (macOS bundle) using LFS on GitHub.

I want to create an image repository and store all my originals (I do editing in Pixelmator Pro).

A Pixelmator "file" looks like this:

directory: myfilename.pxd
    directory: data
      file: ABCD-EFG-XYZ (no file extension, 5 MB)
    directory: QuickLook
      file: Icon.tiff
      file: Thumbnail.tiff
    file: metadata.info

Based on this git-lfs issue, I tried this:

git lfs track 'all_my_pixelmator/files/*

Now my .gitattributes looks like this:

*.tiff filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.m4a filter=lfs diff=lfs merge=lfs -text
*.mp3 filter=lfs diff=lfs merge=lfs -text
media_cards_pxd/images filter=lfs diff=lfs merge=lfs -text

So then I committed the directory and pushed it to GitHub.

However, when I check the GitHub UI, it shows that only the TIFF files are stored in LFS; the data files and the info files are not. When I clone my repo, it has increased in size from 20 MB to 215 MB, so clearly the files got committed incorrectly and are not stored on LFS.

I could add .info to my .gitattributes file, but I don't understand how to add the files in the data directory because they have no file extension (don't know how to do a pattern match in this case).

So how can I configure my repo to ensure that all Pixelmator "files" (any files in a directory that ends in PXD) should be stored in LFS?

Although Pixelmator is macOS software, I'm using git on ubuntu to commit if it matters.


Solution

  • The way to do this is to track all the files in a directory and all subdirectories, which will include all the macOS bundles. Based on this SO answer:

    git lfs track "media_cards_pxd/**"
    

    So the problem was that I was specifying the directory to check incorrectly.