Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to read file from git cache?

I can see list of files using below command

git ls-files --cache

Wondering if it's possible to read the content of the listed file?

like image 254
Isaac Avatar asked Mar 12 '26 12:03

Isaac


1 Answers

Use git cat-file or git show. For example

for f in `git ls-files --cache`; do
    echo -- "----- File (cat): $f -----"
    git cat-file -p HEAD:$f
    echo -- "----- File (show): $f -----"
    git show HEAD:$f
    echo -- "----- End of File: $f -----"
done
like image 125
phd Avatar answered Mar 15 '26 01:03

phd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!