Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to verify that BFG Repo-Cleaner has correctly removed a large file from a git repository?

I have used the BFG Repo-Cleaner to remove a large file from a git repository:

java -jar ../bfg-1.11.8.jar --delete-folders escrow application.git
cd application.git
git reflog expire --expire=now --all
git gc --prune=now --aggressive
cd ..
mkdir clone
cd clone
git clone file:///home/damian/temp/TCLIPG-4370/test/application.git

I have used the script(http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/) to check my repository before and after running BFG Repo-Cleaner and it shows the removal of the escrow directory and there is also a reduction in memory in the two repositories.

Everything looks ok, but how can I verify that all my commits are the same? Would I have to create a script with git-for-each-ref and compare the commits, with the same name, in the two repositories, to verify that BFG has worked correctly?

Any suggestions would be greatly appreciated.

like image 664
Damian Chapman Avatar asked Sep 16 '14 17:09

Damian Chapman


People also ask

How do I remove a large file from my git repository?

If the large file was added in the most recent commit, you can just run: git rm --cached <filename> to remove the large file, then. git commit --amend -C HEAD to edit the commit.

What is BFG repo cleaner?

The BFG is a simpler, faster alternative to git-filter-branch for cleansing bad data out of your Git repository history: Removing Crazy Big Files. Removing Passwords, Credentials & other Private data.

What is not a valid Git repository?

A Git command needs to be run on a specific repository, so this error typically occurs when a Git command is run in a directory that Git doesn't know about. In these cases, the fix is to make sure that you are both working in the correct folder and that you set up your repository right.


1 Answers

You could get an independent opinion from Eric S. Raymond's repodiffer (part of his reposurgeon project): http://www.catb.org/~esr/reposurgeon/repodiffer.html

You use it like this:

$ repodiffer old-repo-copy.git new-repo-copy.git

The script may take a while to run, but it will tell you precisely what has changed between those two repos. Small sample of output:

...
1a54b66 -> 9b11d44: same differences as for 5c572dc -> 6e8307c.
changed: e00a601 -> 30a42c8 in tree.
L only:
  frontend/assets/big.mp4
R only:
  frontend/assets/big.mp4.REMOVED.git-id
...

Full disclosure: I'm the author of the BFG Repo-Cleaner.

like image 103
Roberto Tyley Avatar answered Oct 19 '22 07:10

Roberto Tyley