Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git removing files from future commits but keeping previous versions

Tags:

git

Our git repository has become bloated with older unused files from previous versions.

I wish to remove the files from future pulls/clones but keep the files in the previous commits so they could be pulled if necessary.

It's not necessary to remove local versions if they are already on a users machine but if a new user pulls the repository then they shouldn't get any of the outdated files.

Is this possible and how would I go about doing this?

Thanks in advance!

like image 770
MarxWright Avatar asked Oct 31 '25 17:10

MarxWright


1 Answers

You can delete the unused files what you said use git rm, and then the files will disappear from this commit. If you want to find them out, just reset to the old commit, or use the GUI tools.

like image 65
younghz Avatar answered Nov 02 '25 08:11

younghz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!