In my project, I have a preliminary push git hook that runs unit tests with every click.
But when I try to push changes from one branch, while remaining on the other, unit tests will be performed for the active branch, and not for the currently pressed one.
For example, if I try to push changes from my new_feature branch, while my working directory reflects the structure of the development branch, a preliminary trigger will trigger unit tests for the development branch, not for new_feature.
The main idea to get rid of this is to check the current pushed branch in the pretopic hook. But I do not know how to get information about the current push branch inside the hook: this information is not contained in the hook arguments.
git githooks
Dmitry Sapelnikov
source share