From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 90B851F5AE for ; Fri, 23 Jul 2021 16:47:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230098AbhGWQGy (ORCPT ); Fri, 23 Jul 2021 12:06:54 -0400 Received: from pb-smtp1.pobox.com ([64.147.108.70]:58166 "EHLO pb-smtp1.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229847AbhGWQGx (ORCPT ); Fri, 23 Jul 2021 12:06:53 -0400 Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id DB306D412A; Fri, 23 Jul 2021 12:47:26 -0400 (EDT) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=HQ6helV+djCvC1bFuBcYE4Whw69xZQkcWIOOg2 g+4OA=; b=sRlGi3TMJ1aZogmp48+bRB13pUlYyKIFoMv98JAT29vbe16sgX6trg m1A5eUXso66MKZnUcHfJ3DY+ROR9KyaWXijtd2hu7tFOkAiXt7YgpzaUhzPYzF/e ms+KdyN/IlAJiGpFeQx7tM+bBIlCUoCRX0b5Z3UklwVTe/rYiHyMU= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id D2FE6D4129; Fri, 23 Jul 2021 12:47:26 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [35.196.71.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 5EE91D4128; Fri, 23 Jul 2021 12:47:26 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: Angelo Borsotti Cc: Jeff King , =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , git Subject: Re: Extracting a file References: <871r7qvhhr.fsf@evledraar.gmail.com> Date: Fri, 23 Jul 2021 09:47:24 -0700 In-Reply-To: (Angelo Borsotti's message of "Fri, 23 Jul 2021 09:38:41 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: A930FD6A-EBD5-11EB-BC47-8B3BC6D8090B-77302942!pb-smtp1.pobox.com Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Angelo Borsotti writes: >> You might also like "git checkout -p HASH -- A", which will let you pick >> individual hunks from HASH:A and apply them to your working tree. > > This shows the differences between the committed and the current file, > in a patch > form, which is handy to apply to the current file to make it equal to > the old, but > not if I want to browse the old file and understand how it was before. Why doesn't a straight-forward "check out the path from an old version" work? That is git checkout $old_version -- path/to/file.ext Is it because you have changes to path/to/file.ext already (in which case "mv path/to/file.ext path/to/file.ext-saved" would be a quick way to save it away)? And then path/to/file.ext can be inspected to your heart's content, and when you are done and want to go back to the current state, you can do "git checkout HEAD -- path/to/file.ext" (followed by the earlier "mv" in reverse)?