0

I have a repository whose size has grown over multiple years. My problem is that since multiple people have worked on this repository, few commiters have commited lots of jpeg data or other dataset. These files ofcourse now doesnt exist in the master branch anymore because they are deleted. However, the .pack file in the .git folder shows 5G, where in the size of the master branch is just about 200M.

Now, I would like to push this repository to a server, but the server only accepts a maximum of 3 Gig.

Is there any way, I can list all files accross all the commits (not only in the master branch), but everywhere in the git repository which has contributed to the size of .pack file?

Seconly, after identifying files that I do not want to retain, is it possible to delete them completely in order to reduce the overall size of the push?

infoclogged
  • 3,641
  • 5
  • 32
  • 53
  • Does this thread help answer your question at all? https://stackoverflow.com/questions/11050265/remove-large-pack-file-created-by-git – PhiloEpisteme Jul 17 '19 at 20:56
  • yes, it does. But, first i need to see all the files in each and every commit and only then only i can star rewriting the index. Currently, i dont know how to list all files across all commits. – infoclogged Jul 17 '19 at 21:28
  • One simple way is `git log --oneline --name-only`. – PhiloEpisteme Jul 17 '19 at 21:47

1 Answers1

1

You need to handle this in two steps:

  1. How to find/identify large commits in git history?
  2. How to remove/delete a large file from commit history in Git repository?

This answer to the second question actually includes a good answer taken directly from the first one.

(I would just close this as a duplicate of question #2 because of the combined answer there, but the accepted answer in question #2 defers the large-file finding to BFG. That may or may not be acceptable.)

torek
  • 448,244
  • 59
  • 642
  • 775
  • As written in my question, I am not looking for large files, but large folders. – infoclogged Jul 18 '19 at 04:29
  • Git doesn't store folders. Git stores only files. A file whose name is `a/b/c.ext` means: *extract `c.ext`, **creating** `a/b` if needed to hold it.* Only `c.ext` is in Git. – torek Jul 18 '19 at 04:31