What are git hooks and also what are hooks in general as in Software development(i.e. Server side and client side)
I wanted to have an Explaination. regarding the git hooks and also github actions with a real world example as in a how to implement it on the working scenario.
Hooks in general are a way to execute custom code either before or after some kind of event. They allow you to modify the default behavior of something, for example a function in a programming language.
Git hooks are pretty much the same thing. They allow you to execute a script either before or after an event. Server-side hooks reside on the central git repository server and client-side hooks reside on your local machine. Git hooks can have lots of uses, like checking to make sure the code you're pushing is syntactically correct or running the code you're pushing through a formatter to format the code. You can use your imagination to implement anything you want!
To create a git hooks, you simply go to your repository and there should be a hooks folder. Inside here, you just create some kind of script. The name of the script should match the name of the event that get's fired. For example, you can create a file called
pre-committhat gets executed before each commit happens.