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

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

1
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!

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

That’s it! Have fun with Git!

comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy