[arch-general] git software: howto remove files from history and its objects
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.
Re: [arch-general] git software: howto remove files from history and its objects
On Monday 12 Mar 2012 13:17:11 F. Gr. wrote: 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. Don't forget you can easily copy your repository. Make a complete backup (cp -a is fine), and try your commands. If it doesn't work, just try again on a fresh repository until you get it right :) If you get stuck, ask again here. It'll be easier to help you if you actually run into a specific problem, and have some example output for us to look at. Paul
Re: [arch-general] git software: howto remove files from history and its objects
On Mon, Mar 12, 2012 at 1:17 PM, F. Gr. frgroc...@gmail.com wrote: 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 Seems OK. Just to be sure, start by doing a git clone git_repo new_repo and work on new_repo. This way you could always go back from git_repo if something goes wrong. You may need to do a git filter-branch --prune-empty at the end to remove empty commits. -- Cédric Girard
Re: [arch-general] git software: howto remove files from history and its objects
2012/3/12 Cédric Girard girard.ced...@gmail.com: On Mon, Mar 12, 2012 at 1:17 PM, F. Gr. frgroc...@gmail.com wrote: 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 Seems OK. Just to be sure, start by doing a git clone git_repo new_repo and work on new_repo. This way you could always go back from git_repo if something goes wrong. You may need to do a git filter-branch --prune-empty at the end to remove empty commits. -- Cédric Girard If you want tags get updated, plus `--tag-name-filter cat`.