Skip to content

Instantly share code, notes, and snippets.

View AlSquire's full-sized avatar

Arnaud Lécuyer AlSquire

View GitHub Profile
detach subdirectory:
You want to clone your repository and then use git filter-branch to mark everything but the subdirectory you want in your new repo to be garbage-collected. To clone your local repository:
$ git clone --no-hardlinks /XYZ /ABC
The --no-hardlinks switch makes git use real file copies instead of hardlinking when cloning a local repository. The garbage collection and pruning actions will only work on blobs (file contents), not links.
Then just filter-branch and reset to exclude the other files, so they can be pruned: