Tag Archives: Tar

Tar changed files between 2 commits

Replace [hash] with the hash of the commit. This defaults to all the changed files between the hash and HEAD.

tar zcvf “$(date +’%Y-%m-%d-%H-%M-%S’)-xmple.tgz” $(git diff –name-only [hash])

You can also update the commit range by using two hashes separated with 2 dots.

tar zcvf “$(date +’%Y-%m-%d-%H-%M’)-xmple.tgz” $(git diff –name-only [hash]..[hash2])