Export Untracked, modified, moved and deleted files from a Git repository to archive

less than 1 minute read

Today I wanted to export to a .tar.gz archive all unstracked (new) , modified and deleted files from a Git repository. After some searching, I found a StackOverflow post which helped a lot. So after you cd inside your repository and you have two options:

Export modified moved and deleted files

tar zvcf ~/new-files-cache.tar.gz `git diff --name-only --diff-filter=ACMRT`

Export Untracked (new), modified and deleted files

To achieve that I followed another custom route. If you find something smarter, please inform me!

tar zvcf ~/new-files-cache.tar.gz ` git status --short | sed 's/^ *[^ ]* \(.*\)/\1/g' `

That’s it! Have fun with Git!

Comments