2

I ran the following commands

git lfs migrate import --everything --include="*.pdf"
git reflog expire --expire-unreachable=now --all
git gc --prune=now
git push origin master

The I end up with local files with 1 kB only. I learned that I need an additional

git lfs checkout 

to get "the real files back" and I just wonder, whether there is some command to hide the huge files again, that is some "undo git lfs checkout"?

Concerning git lfs prune: This does not change anything:

$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean

Original files are present, then

$ git lfs prune
* 36 local objects, 29 retained
Pruning 7 files, (935 KB)
* Deleted 7 files

$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean

Files still present...

Christoph
  • 6,841
  • 4
  • 37
  • 89

1 Answers1

1

As of 24 Oct. 2022, you can't. No git lfs uncheckout command exists yet.

As a work-around, maybe just delete the whole repo and re-clone it. WARNING: make sure you've committed all local changes and safely pushed them to the remote before deleting your repo locally, however, or else you permanently lose those changes!

There is an open issue for a feature request for this, however, here: Add command to undo fetch and checkout. Please go there and upvote it and leave a comment to get it some love ❤️. That feature request has been open since early 2016.

Gabriel Staples
  • 36,492
  • 15
  • 194
  • 265
  • OK :-) As my question was more out of curiosity and not a real use case: what is the use case for "uncheckout"? – Christoph Oct 25 '22 at 06:42
  • 1
    @Christoph, to save memory. I work in a repo that is 250 GB in size--nearly all of it being from `git lfs`. My code modules use _zero_ of those `git lfs` files! I'd like to uncheckout them since I'm not even using them to build my code! It's a mono-repo. Other code needs them. – Gabriel Staples Oct 25 '22 at 06:44