How do you set up a git validation hook that checks that pushes to master only contain linear history?
I am trying to set up my git commit history according to https://hackernoon.com/how-the-creators-of-git-do-branches-e6fcc57270fb
I want to enforce that any new commits coming into the
master branch are one of the following:
- simple individual commits, or
- a merge commit that is based off master
* d4ebb82 - simple commit(19 seconds ago) * ec98801 - Merge branch 'cleanup' into 'master' (12 minutes ago) |\ | * d8662fa - Code cleanup (15 minutes ago) | * 43451c5 - work work | * 9adb77d - foo (18 minutes ago) |/ * a2b0c82 - Some work
- a merge commit that is not based off master (i.e. looks like spaghetti)
* 8453901 - Merge remote-tracking branch 'template/master' into dev (6 days ago) |\ | * f2b61c1 - Merge branch 'feature/spring-vars' into 'master' (6 days ago) | |\ | | * db90956 - Added: environment vars (6 days ago) | |/ * | 0e06dcd - Merge remote-tracking branch 'template-stuff/master' into dev (6 days ago) |\ \ | |/ | * 38747d9 - Merge branch 'new-certs' into 'master' (6 days ago) | |\ | | * b36ca67 - added (6 days ago) | |/ * | ...
I'm looking for the script, I can expect it would be in either