Gitlab - run script after create branch

Viewed 435

Is there any option to execute script after branch command: 'git branch new123? If user will create new branch I would like to auto checkout into new branch and auto create folder 'new123' with branch name and two other folder inside this folder like 'int', 'ext'.

1 Answers

You would need:

  • either a GitLab webhook, that is a listener on a server you control, which would receive JSON push events from GitLab, and, when detecting a new branch, would perform the operations you describe in a local clone of the repository.

  • or a GitLab-CI job which can run on every push, and whose job would check if that push is a new branch, before doing the same operation in its workspace (so on GitLab side rather than on a private server like a webhook does)

Related