SeB.Fr
SeB.Fr

Reputation: 1344

git : a file in the history without commits on it, how to explain it?

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.

Upvotes: 2

Views: 92

Answers (2)

SeB.Fr
SeB.Fr

Reputation: 1344

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.

Upvotes: 1

Daniel Geh
Daniel Geh

Reputation: 54

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.

Upvotes: 1

Related Questions