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])

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Post Navigation