rtyley / bfg-repo-cleaner

Removes large or troublesome blobs like git-filter-branch does, but faster. And written in Scala
https://rtyley.github.io/bfg-repo-cleaner/
GNU General Public License v3.0
10.84k stars 535 forks source link

how to present the "repo" in "Usage: bfg [options] [<repo>]" #444

Open DayuanTan opened 2 years ago

DayuanTan commented 2 years ago

It says "Usage: bfg [options] []", like "$ bfg --delete-files id_{dsa,rsa} my-repo.git".

But how to present my repo locally?

I tried

They all don't work.

Thank you very much! I appreciate it very much!

SubOptimal commented 2 years ago

Assuming your repository to work on is a subdirectory of your current directory and is named my-repo-folder-name, then you could run bfg as

bfg --delete-files "id_{dsa,rsa}" my-repo-folder-name

It might be that you just missed the double quotes in that specific case. Without them, your Shell might use brace expansion for the id_{dsa,rsa}. The actual executed command line would become bfg --delete-files id_dsa id_rsa my-repo-folder-name.

Normally in such a case, the error message should provide you already a hint.

$ bfg --delete-files id_dsa id_rsa my-repo-folder-name
Error: Unknown argument 'my-repo-folder-name'
bfg 1.14.1-SNAPSHOT (master-e7cdc46)
Usage: bfg [options] [<repo>]

The command instructs bfg to delete files named id_isa in repository id_rsa, where my-repo-folder-name is interpreted as an additional parameter, which bfg does not know to handle.

Adspectus commented 2 years ago

I can't get this to work either.

I am working in a shell in a directory where the repo I want to work on is in the subdir "abcdef" (actually it is a submodule of an outer repo). Then I would like to remove the file index.php with

java -jar /path/to/bfg-1.14.jar --delete-files "index.php" abcdef

but all I get is usage instruction and

Aborting : abcdef is not a valid Git repository

I tried also adding .git to the repo name without any difference.

SubOptimal commented 2 years ago

Why do you not clone the submodule as a regular repository and do the amendment there?

Adspectus commented 2 years ago

Why do you not clone the submodule as a regular repository and do the amendment there?

I did that, actually by following the docs here (cloning as a bare repo) and this worked.

beaugunderson commented 1 year ago

It might be that you just missed the double quotes in that specific case. Without them, your Shell might use brace expansion for the id_{dsa,rsa}. The actual executed command line would become bfg --delete-files id_dsa id_rsa my-repo-folder-name.

thanks for the hint here, this makes it clear that the documentation is incorrect:

image