Reacting like Peter

In Matthew 16:17 Jesus tells Peter that he is blessed because God the Father has revealed something to him.  A few verses later we see that Peter doesn’t agree with something that Jesus says and Peter begins to rebuke the Lord.  Jesus’ response to him seems harsh.  How is it that this same Peter was blessed by Jesus and then referred to as satan?  How can we relate to acting like this toward God?