How do I execute code before update the content? How do I execute code before updating nodes?

I am looking for a hook to use in a custom module.

I have created a content type. What I need to do is execute a hook before updating any content. I want to keep the history of every content, so I want to execute some code before updating, which will compare previous and currently update record. If there is any change, I want to insert it in another table.

I also want to show that history on the content detail page.
I use the Hook Post Action module because it's execute after the action. So you know that the node is really updated.

So this module introduces several new Drupal hooks to overcome this
limitation

hook_entity_postsave
hook_entity_postinsert
hook_entity_postupdate
hook_entity_postdelete
hook_node_postsave
hook_node_postinsert
hook_node_postupdate
hook_node_postdelete


But, if you want you can use the hook_node_update.
To show info in the node page you can use the EVA module.

&quot;Eva&quot; is short for &quot;Entity Views Attachment;&quot; it provides a Views
display plugin that allows the output of a View to be attached to the
content of any Drupal entity. The body of a node or comment, the
profile of a user account, or the listing page for a Taxonomy term are
all examples of entity content.