Skip to content

Instantly share code, notes, and snippets.

@sarah-j-smith
Last active October 20, 2024 07:22
Show Gist options
  • Save sarah-j-smith/d3eddd59ba87aacef814358570312480 to your computer and use it in GitHub Desktop.
Save sarah-j-smith/d3eddd59ba87aacef814358570312480 to your computer and use it in GitHub Desktop.
The amazingly awesome tar pipe command for copying trees of files around
# https://blog.extracheese.org/2010/05/the-tar-pipe.html
SRC=existing-source-controlled-proj
DEST=copy-of-proj-with-no-git-data
# on Linux and WSL use gnu tar exclude VCS to prevent copying the git data
(cd ${HOME}/depot/${SRC} && tar --exclude-vcs cf - .)|(cd ${HOME}/depot/${DEST} && tar xvfp -)
# on Mac the --exclude-vcs is not available - can add --exclude .git
(cd ${HOME}/depot/${SRC} && tar --exclude='.git' cf - .)|(cd ${HOME}/depot/${DEST} && tar xvfp -)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment