On Mon, 12 Dec 2022 15:55:15 +0600
Enan Ajmain <3nan.ajmain@gmail.com> wrote:
> My knowledge says it should be C1 and C2, but the word you chose,
> "past", makes it seem like C4 and C5.
I mixed up the commit numbers. It should be:
My knowledge says it should be C4 and C5, but the word you chose,
^^^^^^^^^
"past", makes it seem like C1 and C2.
^^^^^^^^^
Also, I forgot to CC the list. Below is my original message.
--
Enan
3nan.ajmain@gmail.com
https://git.sr.ht/~enan/
https://www.github.com/3N4N
=========== Begin forwarded message ===========
Date: Mon, 12 Dec 2022 15:55:15 +0600
From: Enan Ajmain <3nan.ajmain@gmail.com>
To: Marius Orcsik <marius@federated.id>
Subject: Re: Removing a git commit
On Mon, 12 Dec 2022 17:08:19 +0800
Marius Orcsik <marius@federated.id> wrote:
> On 22-12-12 14:03:10, Enan Ajmain wrote:
> > Sometimes I need to delete a commit from a git repo.
> >
> > What's the procedure in such cases?
>
> The high level operation that you need to do is basically rewrite the
> history for the repository for all the commits past the one you want
> deleted.
What do you mean by "past"? For example, if the compromising commit is
C3 in a unilinear sequence of commits C1 to C5, by "past" C3, do you
mean the commits C4 and C5 or C1 and C2. My knowledge says it should be
C1 and C2, but the word you chose, "past", makes it seem like C4 and C5.
This question (above) not really important, since I am leaning toward
adopting your latter suggestion (see below), but I'm still curious.
> I think the accepted solution for this kind of issue, is just take the
> loss, and regenerate the sensitive data that you mistakenly committed
>
Yes, done it already.
> and make sure it doesn't happen again by using something like gitleaks
> in your pre-commit hook.
I'll take a look at that. Thanks.
--
Enan
3nan.ajmain@gmail.com
https://git.sr.ht/~enan/
https://www.github.com/3N4N
=========== End forwarded message ===========
On 22-12-12 16:23:49, Enan Ajmain wrote:
> My knowledge says it should be C4 and C5, but the word you chose,
> ^^^^^^^^^
> "past", makes it seem like C1 and C2.
> ^^^^^^^^^
You're right, I misspoke, apologies.
It's as you said, the commits that are affected are all the commits that
have the deleted commit as an ancestor. Removing it affects the hashes
of it's first order children commits, and that in turn has a cascading
effect to the tip of all the branches that used to contain it.
This makes it that all other clones of the repository past the deleted
commit are now pointing to different hashes, and you're creating
headaches for everyone else.
/Marius