Remove all files except a few files, using filter-branch

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

 



Hi, all.

I want to remove all files except a few files, in the history of my
git repository.

I tried to do that as follows:

    git filter-branch --index-filter "git rm --cached --ignore-unmatch
$(git ls-files | grep -v '^filename$' | tr '\n' ' ')"

But this does not work well if there is a file whose name is not
encoded in us-ascii or includes parenthesis. git-filter-branch is
great to remove some files in my repository, but not good enough to
remove all except only a few.

Does anyone know the better way?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]