There was such a problem that the branches are generated not by an error from a wizard, but from previously existing branches.

I decided to insert a check on the parent branch in the pre-checkout and was surprised that there was no such hook. Post-checkout is, but pre is not.

The only way that I found is to write a wrapper over checkout, but I don’t have any idea how to implement it.

Has anyone encountered a similar situation or knows how to wrap a checkout wrapper?

  • one
    > Появилась такая проблема, что ветки по-ошибке создаются не из мастера A very strange problem. Maybe you should solve it? Or do you develop branches from the current ones, and you want to create branches from the wizard? - strangeqargo

1 answer 1

This can be done using the post-checkout hook when creating a new branch.

Technical details here

And the logic as a whole is this: in post-checkout, if this is a new branch, do git reset --hard master

in principle, branches creating branches — branch and checkout -b , as far as I understand, take the start_point argument (branch — exactly); to create a branch from the value set in the git config (well, push this idea on the github to the torvalds, or who is responsible there)

then you just kick the developers, so that they update the config and live contentedly