There are two things git archive is missing that are needed in my use

First, git archive in combination with tar won't remove unneeded files.
You have to run rm -rf before manually which brings me to the next
point; git archive can't really make incremental updates. Consider an
export that overwrites a tree that resembles the state of an export two
commits before and contains a lot of files. I don't like to idea of
needing to remove all files and write all of them again just to change
one or two lines.

Perhaps my real problem is not "export" but rather "Can I have multiple
work trees with multiple checked out revisions?"...

Am Samstag, den 09.02.2013, 19:45 -0800 schrieb Junio C Hamano:
> Junio C Hamano <> writes:
> > I am not Phil, but if you ask me, I think it is borderline between
> > "meh" and "no way we would give a short-and-sweet -i to something
> > like this".
> I think one reason it was "meh" for me is that we never did an
> equivalent of "cvs export" and "svn export", primarily because
> we had "tar-tree" (aka "archive --format=tar") first, and it was
> sufficient to pipe its outputto "tar xf -" if somebody wanted to do
> the non-existent "git export".  Also "tar-tree" was more useful for
> people who wanted to eventually want to have a tarball (you can
> first "export" and then "tar cf" the resulting directory).
> But I think it is fine to add "git export <revision> <directory>",
> which may look like this, perhaps.
>       #!/bin/sh
>       # git export <rev> <directory>
>       rev=${1?revision} dir=${2?directory}
>       . $(git --exec-path)/git-sh-setup
>         mkdir -p "$dir" || exit
>         git archive --format=tar "$rev" |
>         tar Cxf "$dir" -

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to