René Scharfe <l.s.r@xxxxxx> writes: > Subject: [PATCH] archive: add --strip-components > > Allow removing leading elements from paths of archive entries. That's > useful when archiving sub-directories and not wanting to keep the > common path prefix, e.g.: > > $ git archive --strip-components=1 HEAD sha1dc | tar tf - > .gitattributes > LICENSE.txt > sha1.c > sha1.h > ubc_check.c > ubc_check.h > > The same can be achieved by specifying a tree instead of a commit and > a pathspec: > > $ git archive HEAD:sha1dc | tar tf - > .gitattributes > LICENSE.txt > sha1.c > sha1.h > ubc_check.c > ubc_check.h Another way I am not sure is working as designed is $ cd sha1dc && git archive HEAD . | tar tf - .gitattributes LICENSE.txt sha1.c sha1.h ubc_check.c ubc_check.h I didn't check if the attribute look-up is done on the correct path or export-subst kicks in in such a use, though.