Re: git software: howto remove files from history and its objects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux