Split global and before hooks into separate files
Merge branch 'hooks'