Last active
November 2, 2022 19:05
-
-
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################ | |
# 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