> From: cemico <webmas...@cemico.de>
> How do i remove let's say a "concept_art" folder from all commits (i have 
> about 50 commits by now) and from the pack file?
> I tried many things now. e.g:
> - http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/
> - http://rtyley.github.io/bfg-repo-cleaner/
> - filter-branch with "rm"
> - git gc with prune=now and aggresive
> and the thing i thought which must really work:
> http://git-scm.com/book/en/Git-Tools-Rewriting-History#The-Nuclear-Option:-filter-branch

First, be aware that what you want to do is intrinsically difficult.
Git is oriented toward allowing you to manipulate commits, etc.  But
removing objects from storage is not a task that it is designed to
make easy.  I have had a little experience and I think I can provide
some useful guidance.

You already know how to recreate all your commits with certain
directories or files removed:

    git filter-branch --index-filter $SCRIPT HEAD

You also know how to remove a stored object if it is no longer

    git gc --aggressive --prune=now

What is difficult is ensuring that you have removed all references to
the object.  In general, this involves removing records of past states
of the HEAD, and there are a lot of those records.  You have to remove
the record of the previous version of the branch you are manipulating.
(You have to do this before git-filter-branch, so that
git-filter-branch actually runs, and after it, to remove the value
that git-filter-branch put there.)  Your command looks to me like it
should suffice:

    rm -rf .git/refs/original/

Where I think you have a problem is with the reflog.  In the
repository on which I use git-filter-branch, I have configured

    git config core.logallrefupdates false

To ensure that no reflog entries are generated.  In your case, you use

    git reflog expire --all

But as far as I can tell from the manual page, that means "examine all
reflogs to find expired entries".  You probably need to add
"--expire=now" so that all entries are considered expired.

You can probably examine .git/logs to see if there are any reflog
entries, and what their values are.  My suspicion is that one value
points to a commit that points to the files you want to excise.


You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to