On Tuesday, July 15, 2014 4:41:20 PM UTC+2, cemico wrote:
> I have a git project in which all files are of about 700 MB size.
> In the .git folder lies a "pack" file which is 1.13 GB (Gigabyte)
> I accidently commited files and folders, which don't have to be under 
> version control.
> 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
> None of the above work as expected or better: None work like i need it to 
> work.
> Some delete all commits (the most do that), some don't delete the files 
> from all commits, all(!) don't make the "pack" file smaller after deleting 
> all files and folders i don't want.

You're not giving us a lot to work with here. What were the commands you 
made? What was the output? What was the expected output?

> What i need is:
> - Exclude files and folders from my repo
> - Delete all references to theses files and folders from all commits
> - But don't delete any old commit
> - Rewrite the pack file, so that not any of the excluded files and folders 
> are in it
> What is the way to achieve that?

Filter-branch is the fallback tool when you know exactly want, and you 
don't mind the work of finding the right command to write, plus waiting for 
it to run (can take some time in large repositories).

Be aware that even after running filter-branch your repo will still be 
pretty big until you rinse out all the old stuff.

Here's an example I ran on some repos a while back:

# remove folders 'sandbox' and 'servers', and prune all empty commits:
git filter-branch -f --index-filter "git rm -r -f --cached --ignore-unmatch 
sandbox servers" --prune-empty

# clean away original refs left behind by filter-branch:
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git 
update-ref -d
# empty reflog:
git reflog expire --expire=now --all
# remove remotes:
git remote rm origin
# remove work tree changes:
git reset --hard
# clean up:
git gc --aggressive --prune=now

Remember to always make backups before you start filter-branching!

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