split pre_commit and post_commit in separate file, and simplify the layout, by renaming commit_hook to hook directly