2

I am migrating many svn repositories to many other git repositories. Those svn repos have more than 113000 commits. I end up with very large git repos and I like to shrink them.

I have used a script to find out the largest objects. These objects are not in any branches anymore and I wanted to know to which commit they where related. I could not find any ???

I used the command

git log --pretty=oneline --branches -- my_big_file_full_path

But nothing was returned. Can someone explain me why this file has no associated commits ? If that is really the case how to remove all the files that are not linked to any commits ?

PS : the migration process is quite heavy and I am using bfg (which is fantastic) to remove some known unused folders.

SeB.Fr
  • 1,246
  • 1
  • 14
  • 16
  • "*I have used a script to find out the largest objects.*" There's more than 1 script in the blog post that you linked to, can you please edit into your question **the exact code** that you used? –  Jul 03 '14 at 04:25
  • @Cupcake: what do you mean? I only see one script there. – László Papp Jul 03 '14 at 06:39

2 Answers2

1

Did you clean the repository after using The BFG? As mentiond in the "Usage" section on the BFG site you should use

$ cd some-big-repo.git
$ git reflog expire --expire=now --all
$ git gc --prune=now --aggressive 

to get rid of objects in the repositories that are not part of any commit.

Daniel Geh
  • 54
  • 4
  • Thank a lot for that suggestion but this does not resolve my problem. Indeed it reduced the size of my repository but the "my_big_file_full_path" is still present and I still not related to any commit. I wish I knew why? – SeB.Fr Mar 11 '14 at 13:40
  • It actually was just a suggestion. Would have posted it as a comment, but my rep score wouldn't allow for that. What you describe sounds like a dangling commit to me, and you get rid of these with the commands mentioned. What does git fsck --full tell you? – Daniel Geh Mar 11 '14 at 14:33
  • the git fsck seems to be ok here what I have got git fsck --full Checking object directories: 100% (256/256), done. Checking objects: 100% (144252/144252), done. But I still got most of the biggest objects not related to any commit. – SeB.Fr Mar 14 '14 at 08:09
  • Then you have e.g. tags referencing some tree in which your big file is still referenced. What does git log --pretty=oneline --all -- my_big_file_full_path tell you? – Daniel Geh Mar 14 '14 at 17:16
  • Dear Daniel, unfortunatly this command give no result at all. Just like the first one I used. – SeB.Fr Mar 14 '14 at 22:07
1

I have finally found the answer in another stackoverflow question Which commit has this blob? using the shell script allowed me to find the commit that modified the big file.

Community
  • 1
  • 1
SeB.Fr
  • 1,246
  • 1
  • 14
  • 16