We have changed from SVN to GIT ( bitbucket ) a few months ago, now we are recieving a warning that our git repository is becomming to large ( currently at 2.2GB ). However when i check the local size our project is only - 600MB in size. This is a project that has been in development for over 6 years so there are many commits ( history ) especially files like .jar viles that got added, and than back deleted to be replaced with newer versions etc. They don't exist on our current project anymore, but they are still in the git history where they take up space that isn't needed because we won't ever use them again, i'm looking for a way to remove all deleted files that don't exist in the current project and remove them completely from the git commit history ( not all files that ever got deleted ). I know that there is the 'git-filter' command to remove a file from the commit history but as far as i can see you have to specify wich file to be remove while i have no idea how many / wich files got deleted over the years in our project.
CodePudding user response:
You can use the command git filter-branch
git filter-branch --index-filter \
'git rm -rf --cached --ignore-unmatch path_to_file' HEAD
Be careful because you will rewrite the history of your deposit