3

I have several folders of jpg files on my OSX laptop, cloned from a GitHub repository. The files I can see total less than 20GB, but my system tells me that they occupy 65+GB.

https://i.stack.imgur.com/65BFp.png

Where are these hidden files? How can I purge them?

I should mention that there is only one branch in the repository.

(Also, I know that GitHub is not meant to be a place to store lots of image files. This repo is a component of a larger project.)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Will Hanley
  • 457
  • 3
  • 16
  • To clarify, you want to know how to remove the local copies of the image files, but retain them in the online "origin" repository? – neontapir Oct 06 '17 at 19:32
  • 1
    The extra space could be from the Git history. Keep in mind that Git keeps a copy (or the information that it needs to revert to a copy) of every committed revision of the file. – zneak Oct 06 '17 at 19:33
  • What I want(ed) to do, @neontapir, was to retain them in the online "origin" repository (along with all their history) but only keep the most recent copy locally. – Will Hanley Oct 07 '17 at 03:02
  • Thanks @zneak. I suspect that what I wanted to do is not possible? – Will Hanley Oct 07 '17 at 03:06
  • @WillHanley, if you don’t care for history, you can look into shallow clones. – zneak Oct 07 '17 at 03:12

2 Answers2

4

As mentioned in "Show system files / Show git ignore in osx", use in your Finder .

That should show you the hidden folder .git/, which include all the history of the repo.
And for a repo of binaries (like jpeg images), and new version of an image might take quite a lot of place (poor diff, poor compression between each version)

I wonder if there's any way I can purge this history from local storage? (I'd like to keep it in the cloud)

You would need to download only the archive of the repo (meaning the content, without the history).
If you don't need to change and push back those modification, the archive would be enough.

If you need the history, a shallow clone (git clone --depth 1) that I detailed here (or here) is best to keep the downloaded data at a minimum.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks @VonC. I can see it now. I wonder if there's any way I can purge this history from local storage? (I'd like to keep it in the cloud). – Will Hanley Oct 07 '17 at 03:08
  • @WillHanley I have edited my answer to address your comment/question. – VonC Oct 07 '17 at 04:57
  • Thanks. I want to continue to push modifications, so will try the shallow clone suggested by @zneak and described [here](https://stackoverflow.com/questions/19352894/how-to-git-fetch-efficiently-from-a-shallow-clone). – Will Hanley Oct 07 '17 at 19:46
  • @WillHanley OK. I have edited the answer to add the shallow option, with links to old answers of mine where I describe a shallow clone. – VonC Oct 07 '17 at 19:50
0

I would try re-indexing your hdd and see if that accurately displays file sizes once its done.

Run the following in osx terminal:

    sudo mdutil -E /

Original article:

https://www.maketecheasier.com/fix-wrong-hard-drive-data-usage-calculation-osx/

Matt
  • 11
  • 1