amazingly, this seems to be hard, and I don't see the answer anywhere online. simply list all the category of the current post (on single.php), but also all the parent categories of it.
<?php the_category( ', ' ); ?>
only lists and links to the subcategory the post is added to.
so, if a post is added to a subcategory called 'apples', and that category has a parent category called 'fruits', show and link to
fruits >> apples
or, if its parent category has a parent category, list and link to that one too
green >> fruits >> apples
simply said, list and link all of them, parent or child.
Update: thanks to @Svartbaard answer for pointing me in the right direction, I passed the category id and it works:
<?php $categories = get_the_category(); $cat = $categories->cat_ID; echo get_category_parents( $cat, true, ' » ' ); ?>