Skip to content

Instantly share code, notes, and snippets.

@nachoalonso
Last active June 14, 2020 22:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nachoalonso/e511dbcabbe8e9b1ba7b26dc2b0626ac to your computer and use it in GitHub Desktop.
Save nachoalonso/e511dbcabbe8e9b1ba7b26dc2b0626ac to your computer and use it in GitHub Desktop.
# The following command removes git-fat (https://github.com/jedbrown/git-fat)
# from a Git repository.
#
# Requires Python 3 and git-filter-repo (https://github.com/newren/git-filter-repo)
#
# Note that this rewrites the history of the Git repository and forces everyone
# to clone again
# Steps: Get a new clean copy of the Git repository and then run
cd {git_repository}
git filter-repo --blob-callback "
import os
GIT_FAT_HEADER = b'#\$# git-fat'
print('.', end='')
if (blob.data.startswith(GIT_FAT_HEADER)):
object_id = blob.data.decode()[12:52]
fat_file_path = os.path.join('{full_path_to_fatstore}', object_id)
with open(fat_file_path, 'rb') as file:
blob.data = file.read()"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment