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:

  1. Export modified moved and deleted files

    tar zvcf ~/new-files-cache.tar.gz `git diff --name-only --diff-filter=ACMRT`
    
  2. 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!

Advertisements

About cmanios

programming
This entry was posted in Git, Linux, Source control and tagged , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s