Home > Software engineering >  Can I create a git hook that runs a script based on the tags for the commits being pushed?
Can I create a git hook that runs a script based on the tags for the commits being pushed?

Time:06-24

I am trying to create a git hook such that when a user pushes it will take information about the tags attached to the commits and create an archive with the same name as the tag. I really only need to know if it is possible to use a pre-push hook for this and how to determine the information I need for the script specifically how to reference individual commits and their tags. Thanks!

CodePudding user response:

For those curious, I had finally learned that the references to commits and tags are passed through the stdin rather than the program arguments as I had previously thought, so when you read from stdin you get something like: refs/heads/main SHA-1 refs/heads/main SHA-1 refs/tags/v4.0 SHA-1 refs/tags/v4.0 0000000000000000000000000000000000000000

  •  Tags:  
  • git
  • Related