Created
May 13, 2016 20:01
-
-
Save nflint/b5fe1668427735ad560b0cbe0c40560c to your computer and use it in GitHub Desktop.
Git command to export untracked files.
This file contains 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
git ls-files --others --exclude-standard -z | cpio -pmd0 path/to/directory | |
git clean -d -f | |
# git ls-files: print a | |
# * null-delimited (-z) list of | |
# * untracked (--others) | |
# * non-ignored (--exclude-standard) files. | |
# cpio: | |
# * copy (-p) | |
# * files in a null-delimited list (-0) | |
# * create missing directories (-d) | |
# * preserve modification times (-m) | |
# git clean: remove untracked non-ignored files | |
# from https://snipt.net/akaihola/move-untracked-files-outside-a-git-repository/ | |
# * and empty directories (-d) | |
# from the working tree |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment