Created
October 29, 2020 08:26
-
-
Save JeanDavidDaviet/15165b61a527b19831f7f88906c7ff83 to your computer and use it in GitHub Desktop.
Take a backup of untracked files
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
| # Most of the time, it's safe to delete all the untracked files. But many times, there is a situation wherein you want to delete, but also to create a backup of your untracked files just in case you need them later. | |
| # Git, along with some Bash command piping, makes it easy to create a zip archive for your untracked files. | |
| git ls-files --others --exclude-standard -z | xargs -0 tar rvf ~/backup-untracked.zip | |
| # The above command makes an archive (and excludes files listed in .gitignore) with the name backup-untracked.zip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment