Skip to content

Instantly share code, notes, and snippets.

@scottschreckengaust
Last active November 2, 2022 19:05
Show Gist options
  • Save scottschreckengaust/49e3c28fa5852476a709c628d576f566 to your computer and use it in GitHub Desktop.
Save scottschreckengaust/49e3c28fa5852476a709c628d576f566 to your computer and use it in GitHub Desktop.
Schreck's Useful Snippets - seldom used, way useful, but hard to remember
################################################################################
# This will minimize a repository to only the current commit:
################################################################################
export ORIGIN_URL=$(git remote get-url origin); \
export COMMIT=$(git rev-parse HEAD); \
rm -rf .git; \
git init .; \
git remote add origin ${ORIGIN_URL}; \
git fetch origin ${COMMIT} --depth 1; \
git reset --mixed ${COMMIT}; \
unset ORIGIN_URL; \
unset COMMIT;
################################################################################
#
################################################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment