Re: [Question] Can git cat-file have a type filtering option?
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Apr 9, 2023, 01:23 UTC
- Message-ID
- <ZDITjrSU7jADX/Jw@nand.local>
- In-Reply-To
- <CAOLTT8RTB7kpabN=Rv1nHvKTaYh6pLR6moOJhfC2wdtUG_xahQ@mail.gmail.com>
On Fri, Apr 07, 2023 at 10:24:22PM +0800, ZheNing Hu wrote:
> However, `git cat-file` already has a `--filters` option, which is > used to "show content as transformed by filters". I'm not sure if > there is a better word to implement the functionality of filtering by > type? For example, `--type-filter`?
There is the `--filter='object:type=blob'` that should do what you're looking for.
In other words, if you wanted to dump the contents of all blobs in your repository, this should do the trick:
$ git rev-list --all --objects --filter='object:type=blob' |
git cat-file --batch[=<format>]Thanks, Taylor