# Get (Git) the last commit files into a zip file with folder structure

This is a handy command when working with Git.  
  
```
git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT HEAD~1 HEAD | xargs tar -rf /d/temp/changes.tar
```
  
It basically takes all the changes from your last commit including the folder structure.

See more info on this [SO Question](https://stackoverflow.com/questions/4541300/export-only-modified-and-added-files-with-folder-structure-in-git).

---

*This article was originally written on Google's Blogger platform and ported to Hashnode on 17 Sep 2022.*

