threads / discuss / 11409

checkout without touching HEAD

Subject: checkout without touching HEAD

## tl;dr

3 messages between Dec 27, 2007 and Dec 27, 2007.

replies: 2people: 2as markdown or json

Martin Langhoff· Dec 27, 2007, 22:22 UTC · lore

Is there a way to get a 'checkout' of a treeish _directly_ from git to an empty (or 'no conflicting paths'-guaranteed) directory, without touching HEAD?

Using `git-archive ... | tar -x` is a waste of time and resources -- I do want this to be fast for large datasets. I have hacked it a bit by backing up HEAD, using git checkout with a temporary index, and then restoring HEAD, which I can do because my script has a big fat lock around it. But it's very un-gittish to need a big lock around me.

Maybe there's a command I'm missing? Or a zikrit option to checkout I haven't found?

cheers,
m
Junio C Hamano· Dec 27, 2007, 22:38 UTC · re: Martin Langhoff · lore

Re: checkout without touching HEAD

"Martin Langhoff" <martin.langhoff@gmail.com> writes:
Show 9 quoted lines
> Is there a way to get a 'checkout' of a treeish _directly_ from git to
> an empty (or 'no conflicting paths'-guaranteed) directory, without
> touching HEAD?
>
> Using `git-archive ... | tar -x` is a waste of time and resources -- I
> do want this to be fast for large datasets. I have hacked it a bit by
> backing up HEAD, using git checkout with a temporary index, and then
> restoring HEAD, which I can do because my script has a big fat lock
> around it. But it's very un-gittish to need a big lock around me.
git read-tree -m -u HEAD $treeish
Martin Langhoff· Dec 27, 2007, 22:48 UTC · re: Junio C Hamano · lore

Re: checkout without touching HEAD

On Dec 28, 2007 11:38 AM, Junio C Hamano <gitster@pobox.com> wrote:
> git read-tree -m -u HEAD $treeish
Thanks! Trying it now...

(I'm combining git with PostgreSQL's PITR snapshot+xlog technique for an automated, reasonable-disk-footprint "rewind my webapp to any arbitrary point in time in the last X days" facility, mainly for edit-heavy web apps like Moodle. So far, it's looking good ;-) -- could be a killer feature for the LAPP platform... )

m

← back to recent threads