Result of lots of searching on net is that pre-checkout
hook in git is not implemented yet. The reason can be:
I got the reason why it was not implemented. In my situation I do backup the database and store it in a file, which will fail the check-out every-time. So this will be impractical to implement this functionality.
You could write a script that does your backup then checkout. Then create a shell alias so it runs that script instead when you type git checkout
.
Pre-checkout use case: delete un-versioned local files generated by gulp watch:css
task so they are overwritten after checkout and rebuilt by gulp.
Instead, I'm just going to write a shell script that gets the repo root and then deletes any of a list of gulp-generated files found.