git filter branch - Remove contents of a commit from a git repo after its already been git -rm'ed and pushed -
so had user add , remove large directory of files in workspace 2 distinct commits. pushed changes central repo , end user looks noop. problem our central repo has jumped 50x in size because of this. have tried several things filter branch , not working.
so folder added @ root level. name of .core
i have tried following filter-branch based on links:
http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/
remove directory permanently git
the final commands have tried looks this:
git filter-branch -f --index-filter "git rm -rf --cached --ignore-unmatch .core" --prune-empty --tag-name-filter cat -- --all rm -rf .git/refs/original rm -rf .git/refs/logs git reflog expire --expire=now --all && git gc --prune=now --aggressive
the resulting output says ref unchanged. have tried changing reference of .core various variations such ./.core, *.core/*, ..... nothing getting removed.
thanks.
use the bfg, simpler, faster alternative git-filter-branch
, designed removing unwanted files git history.
carefully follow bfg's usage instructions - core part this:
$ java -jar bfg.jar --delete-folders .core my-repo.git
any folder named .core
(that isn't in latest commit) removed git repository's history. can use git gc
clean away dead data:
$ git reflog expire --expire=now --all && git gc --prune=now --aggressive
the bfg typically @ least 10-720x faster running git-filter-branch
, , easier use.
full disclosure: i'm author of bfg repo-cleaner.
Comments
Post a Comment