As a relative pronoun, "which" can be used to refer to a sentence; for example,
She ignored him, which proved to be unwise.
In this case, a comma should be necessary.
In The rite of spring written by Arthur Miller, I found such sentences:
... As an example: you simply have to face the moment when you must admit that the lettuce was planted too deep or was not watered enough, cease hoping it will show itself tomorrow, and dig up the row again. But you will feel better for not standing on your dignity. And that's what gardening is all about—character building. Which is why Adam was a gardener. (And all know where it got him, too.)
I am not sure if "which" in the context is a relative pronoun or a demonstrative pronoun.
As a relative pronoun, a comma should be needed before "which" instead of a period.
As a demonstrative pronoun, can "which" be a demonstrative pronoun?