Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to the Power Users community on Codidact!

Power Users is a Q&A site for questions about the usage of computer software and hardware. We are still a small site and would like to grow, so please consider joining our community. We are looking forward to your questions and answers; they are the building blocks of a repository of knowledge we are building together.

Post History

71%
+3 −0
Q&A How to delete old files in GIT while keeping history?

I'm far from an expert GIT user. I'm usually the only one working in a repository at a time, and know how to do the basics like committing snapshots. I still have to look up how to create and mer...

1 answer  ·  posted 4d ago by Olin Lathrop‭  ·  last activity 4d ago by Michael‭

Question git
#1: Initial revision by user avatar Olin Lathrop‭ · 2025-03-28T13:59:55Z (4 days ago)
How to delete old files in GIT while keeping history?
I'm far from an expert GIT user.  I'm usually the only one working in a repository at a time, and know how to do the basics like committing snapshots.  I still have to look up how to create and merge branches on the relatively rare occasions I need to use them.

We have some repositories that have gotten large, past the limit of the free hosting service we are using.  Early on, some large files that don't really need to be tracked (like .EXEs) were accidentally included in the files GIT tracks.  There are also a lot of old versions of some large files we'll never get back to.  It would be nice to delete both these kinds of files, but still keep the commit history.

Of course we could copy the GIT repository, clean it out properly, make sure only the files we really need to be tracked are tracked, create a whole new repository and delete the old one (after archiving it on long-term media, of course).  However, that looses the history being easily accessible in one place.

Is there a way to effectively fully delete files with all their versions from a GIT repository while still retaining the history and old versions of all other files?
git