0

My git repo is 10MB because of the .pack file(9.8MB). I want to delete this from the git repo. I went through a lot of similar posts. One of them here suggest to save the code and .git and start a new repo. Others suggested to use git gc which can pack all .pack into 1 pack file. But I just have 1 pack file. So this makes me believe that there is no way to delete the one pack file? Or is there a way to delete it?

[EDIT]

I tried deleting it with the following command:

git --work-tree=/path rm pack-xxxx.pack

It gave the following error:

fatal: pathspec 'C:/Users/a80050652.CHINA/Contacts/deploy_osk/.git/objects/pack/pack-25e1b6c09af51440fec2159be951d2acf6eeca4e.pack' did not match any files

Community
  • 1
  • 1
Ankur Bhatia
  • 996
  • 3
  • 17
  • 29
  • You don't want to delete the .pack file. It contains most of the history of your project. – axiac Sep 27 '16 at 10:44
  • Thanks @axiac. So there is no way to reduce it ? My code is just 200KB. I tried the git gc command as well. Everytime I clone it I have to clone the full 10MB. Can I add it in the gitignore? – Ankur Bhatia Sep 27 '16 at 10:50
  • 1
    No. Things under `.git` aren't part of the files you track with `git add` or `commit`. They are part of `git`'s information. That being said, did you commit a large binary file at one point? – Zeta Sep 27 '16 at 11:00
  • Yes @Zeta. I seem to have done that. I guess I need to find the SHAs of those commits and delete it from the history? – Ankur Bhatia Sep 27 '16 at 11:22
  • 3
    Your *current* code has only 200KB, whole history of changes has 10MB. If don't want to clone 10MB, you can always clone only last commit with `git clone --depth 1 ` – qzb Sep 27 '16 at 11:49

0 Answers0