What is the difference between "that" and "which"?
That - "That" is used with restrictive phrases. Restrictive phrases are phrases that are essential to the sentence.
Which - "Which" is used with non-restrictive phrases. Non-restrictive phrases are phrases that state non-essential information. A phrase is considered a non-restrictive phase if the phase can be omitted from the sentence.
The shirt that you lent me is in my bag. (Restrictive)
The shirt, which is red, is in my bag. (Non-restrictive)
The house that I wanted to buy has been sold. (R)
The house, which I didn't want to buy, has been sold. (NR)
The pub that I go to all the time is open. (R)
The pub, which is near my house, is closing.