Modify files and commit after Branch creation in GIT via Hook

87 views Asked by At

We are currently migrating our repositories from Subversion to Git, because our planned Branch model is really hard to set up with SVN.

One requirement of the Branch model is, that when a Branch is created, all Version numbers need to be changed.

Currently for SVN we have a tool that created the branch remotely, checks it out, replaces all version numbers and commit these changes. Merging has to be done manually and the version change commit needs to be skipped.

In Git we want to use the Git flow feature that is also integrated in Source Tree (the Client that we prefer to use).

One option is to write a tool that can be called from Source Tree as a custom action to replace the version numbers and commit the changes.

After I migrated out pre-commit Hook from SVN to Git my thought was if this feature couldn't be created as a hook, but I haven't really found a hook that is called when a branch is created.

The way back where the version numbers need to be changed when merging into the soruce branch could theoretically be done in the post-merge Hook.

Now my Questions are:

  1. Is it possible to detect a branch creation on client side and modify some files and commit them in a hook?

  2. Would it work to modify files and commit them in the post-merge hook?

Thanks for your help!

0

There are 0 answers