Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to avoid deleting files with same name? #204

Open
loveencounterflow opened this issue Mar 7, 2017 · 3 comments
Open

How to avoid deleting files with same name? #204

loveencounterflow opened this issue Mar 7, 2017 · 3 comments

Comments

@loveencounterflow
Copy link

Ideally I would want to precisely specify the path of a given file to delete. If the file to be deleted is not the only one in its folder and there is a namesake file somewhere else in the project, then the history of both files will be gone after bfg --delete-files xy.zzz. Renaming the other file before running bfg will keep the other file, but also erase its history.

Running The BFG has been great so far but I wonder why the simplest of use cases isn't covered. Shouldn't it be trivial given that globs against filenames do work?

@rosasurfer
Copy link

rosasurfer commented Mar 18, 2017

Not only it happily deletes all your files of the given name but additionally I can't manage to get a log or report of the files BFG deleted this way. The file in the report folder is useless to me as it shows the file name as entered, something I already know. I can't find a way to show which files have been deleted.
Also I miss a dry-run-mode which shows the file going to be touched before. I'm surprised, too, this is not covered.

I tried BFG but because of these issues I had to back to the much more complicated git filter-branch.

@javabrett
Copy link
Contributor

This is a long-standing feature-request, see #79, #12 .

The lack of this feature is brought-about by the way BFG processes trees - it only looks at the filename within the tree it is processing, so the context provided by all parent trees to the root (i.e. the full file-path) is not considered. From memory, with some moderate amount of effort, this might be added. There would be some memory and/or execution-time performance costs for this. Someone might even contribute a patch for this?

The alternative often used is to pre-parse the entire object database and get the blob IDs of blobs to be removed - that way you can select them by full paths. BFG then supports removal by blob ID, so you can remove very specific paths that way.

@thomassajot
Copy link

Git-filter-repo is able to remove file given a path from the repo's root. It is recommended in git's own documentation on git-filter-branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants