From: "Matt Hunter" <m@lfurio.us>
To: "Patrick Steinhardt" <ps@pks.im>, "Sphinx" <sphinx9692@gmail.com>
Cc: <git@vger.kernel.org>
Subject: Re: Question: behavior when reverting a commit from a shallow clone
Date: Mon, 05 Oct 2026 06:41:31 -0400 [thread overview]
Message-ID: <DLWUB05MOV7T.2XA7NG57870ZD@lfurio.us> (raw)
In-Reply-To: <asNKZpxiuFhVkVQd@pks.im>
On Mon Oct 5, 2026 at 2:57 AM EDT, Patrick Steinhardt wrote:
> On Sat, Oct 03, 2026 at 02:24:42PM +0530, Sphinx wrote:
>>
>> If an operation is then performed to restore/revert B, I was looking
>> into the behavior when the resulting working tree/index becomes empty
>> — effectively causing all tracked files to be removed.
>
> Yeah, this can indeed be surprising behaviour. The reason for it is that
> in a shallow clone, we rewrite the boundary commit (so in your case B)
> so that it doesn't have any parents anymore. It thus looks like just
> another root commit that has added all files in a single go. And the
> consequence of that is that reverting it will then delete everything.
Separate question from the sidelines: As a non shallow clone user, this
makes me wonder if/how these boundary commits might be munged to
preserve original commit ids in the clone? eg: so a fast-forward
pull still works for future content
next prev parent reply other threads:[~2026-10-05 10:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-03 8:54 Question: behavior when reverting a commit from a shallow clone Sphinx
2026-10-03 19:41 ` Carlisle T. Hamlin
2026-10-05 6:57 ` Patrick Steinhardt
2026-10-05 18:10 ` Carlisle T. Hamlin
2026-10-05 6:57 ` Patrick Steinhardt
2026-10-05 10:41 ` Matt Hunter [this message]
2026-10-05 16:38 ` Junio C Hamano
[not found] ` <CALfz8QzymKxvzYGWLwdtzERDm1apa8ebZEVyLne18hpTaB=D0g@mail.gmail.com>
2026-10-05 17:35 ` Sphinx
2026-10-06 15:54 ` Junio C Hamano
2026-10-09 17:34 ` Sphinx
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DLWUB05MOV7T.2XA7NG57870ZD@lfurio.us \
--to=m@lfurio.us \
--cc=git@vger.kernel.org \
--cc=ps@pks.im \
--cc=sphinx9692@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox