[arch-general] git software: howto remove files from history and its objects

F. Gr. frgroccia at gmail.com
Mon Mar 12 08:17:11 EDT 2012


Hi,
I'm a new user of git software. I imported a mercurial repository to
a git repository. Now I want to remove some files from history and
the objects in my repository. Are these the right commands?

git filter-branch -d /dir1/subdir/ --index-filter 'git rm --cached -f --ignore-unmatch' -- --all
rm -rf /git_repo/.git/refs/remotes/origin
git reflog expire --expire=0 --all
git gc --aggressive --prune=0

then (perhaps :-) I can push to my remote repository. I haven't tried 
the above commands yet because I don't want to break my repository.



More information about the arch-general mailing list