I needed a way to mock the trigger that would usually be sent from e.g. Github to your CI/CD system. This is what I use the Git hooks for.
The way it works is: To get the post-update hook to trigger, you have to push because post-update is triggered by git-receive-pack after a push. So this is why you create a local remote and push to it. This also mirrors the workflow when using the Kubestack framework for real infrastructure.
The goal for the local development environment was to mirror the real workflow. So that people can also use it to try the framework without having to create real cloud infrastructure.
So the hook also needs to trigger a pipeline. Because the best practice is to have the pipeline live with the code, the post-update script will checkout the pushed commit-hash to a third repository and will call the mock-pipeline shell script that's part of the checkout.
You will then see the terraform plan/apply output as part of the remote output coming from the Git push.