Do not stifle the Holy Spirit. And don’t stifle those who have a word from the Master. Test everything that is said. Hold on to what is good. Throw out anything tainted with evil. 1 Thessalonians 5:19-22 [Adapted]
The Word of God tells us there are two ways in which we work at odds with the Holy Spirit. The first is by quenching (stifling) the Spirit. We do this by ignoring His promptings and failing to allow the Spirit to express himself in our attitudes and actions.
The second way we can be at odds with the Holy Spirit is to grieve Him. We grieve the Spirit by living out of alignment with God’s Will. By acting in a sinful manner, whether it is in thought, or in both thought and deed. To understand what it means to grieve the Spirit, we must first understand that the Spirit possesses personality. Only a person can be grieved. As Jesus was both God and man, the Spirit is also a (divine) person who is able to feel human emotion. Once we understand this we can better understand how He is grieved, since we too feel the emotion of being grieved.
Just as we do not like to be quenched or grieved, so we should not quench or grieve the Holy Spirit. Suppose God brings you to a crisis and you almost endure it, but not completely. He will engineer the crisis again, but this time some of the intensity will be lost. You will have less discernment and more humiliation at having disobeyed. If you continue to grieve His Spirit, there will come a time when that crisis cannot be repeated, because you have totally stifled Him. But if you will go on through the crisis, your life will become a hymn of praise to God. Never become attached to anything that continues to hurt God. In order to be free of it, God must be allowed to destroy whatever it may be.
Adapted from @GotQuestions and My Utmost For His Highest