Re: Deleting first commits; maintaining last commits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2025-02-20 at 22:53:06, Jamenson Espindula wrote:
> Hi all.

Hi,

> My Git repository on GitHub <https://github.com/espindula/br-blfs> has
> about 23,500 commits. However, there are several old (before Feb, 28
> 2022) commits I would like to delete and maintain the newer ones
> (after Feb, 28 2022). So, Is there any Git command (or combined
> commands) I could use?

No, Git doesn't offer such a thing.  Due to the use of cryptographic
hashes used, it would be impossible to verify the integrity of the
repository if it could just be truncated like that.  In addition, the
goal of Git as a version control system is to track history, not to
destroy it.

However, if the concern is size and not something else (like removing
personal information), then you could use a shallow clone to just
download a certain number of revisions and work on that.  The full
history would remain on the server, and you could still push newer
changes, but the size on your local machine would be smaller.  If you
need more history, you could use a partial clone instead if you're
willing to be online to work.

I'll note that 23,500 commits is not that many.  Git itself has 76,212
commits in my local copy, Linux has over 1,335,000, and I routinely work
on a work project with over 500,000.  Git should scale much farther than
that provided you don't have a really misshapen repository.
-- 
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux