1

I removed a folder\files from my Git repo by running

git rm -r --cached Application01 

to untrack all the files in that folder and reduce the size of the Git repo.

The problem is that the pack file .git/objects/pack/*.pack is still holding the files I removed\untracked.

How can I completely remove all untracked files and lose all their history and make the pack file smaller?

Thanks

1
  • 1
    The files still exist in your version history - after all, git is a version control system - so if you really want to reduce the size of your repo you need to rewrite history. Commented May 23, 2017 at 8:00

1 Answer 1

1

try to run this command

git gc 

this will run git garbage collector to clean up unnecessary files and optimise your local repository

Sign up to request clarification or add additional context in comments.

3 Comments

you can try with the option --aggressive as well. See documentation below git-scm.com/docs/git-gc
I tried git gc --prune=now --aggressive, but that didn't remove the files.
I think the problem has been solved here stackoverflow.com/questions/11050265/…

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.