Coding Flow - fredericrous/git-templates GitHub Wiki
The workflow
You are working on a badass feature. Now's the time to share your work.
You hit git commit
, a nice template message
appears to help you write a meaningful log description.
Or maybe you are lazy and just write git commit -m"Add to Cart"
.
Pre-commit
Git triggers the pre-commit
hook before the commit actually occurs. The hook calls in parallel all the scripts prefixed with pre-commit-
. These scripts check the staged files for code that shouldn't be commited as is and more, see section Hooks implemented.
If one check fail, the commit is aborted.
Once the tests have passed, the next hook is triggered, commit-msg
.
Commit-msg
This hook lints your message, to help to keep some conventions in place, and it happens an emoji to your commit.
Here are the conventions the hooks from this repository takes inspiration from:
- https://git-scm.com/docs/git-commit
- https://www.conventionalcommits.org/en/v1.0.0/
- https://gitmoji.dev/
Once the message complies with the checks, the commit is finally created.
Pre-push
When you run the command git push
, the hook pre-push
gets triggered. All the scripts prefixed with pre-push
get executed in sequence. See section Hooks implemented.
Some of the hooks give you recommendation to help you resolve the branch state you are in