Member-only story
Learning Mobile Development
Learn How to Setup Git PreCommit Hook for iOS and Android Projects
A Very Useful Knowledge To Better Control Code Changes For Your Team
If you work in a team, or even you work yourselves on a mobile project, you want a reminder prior to you get your code committed, the git pre-commit hook will be an awesome tool you want to use.
This is not a common knowledge required by mobile, but it’s really handy. Here I’m building a git pre-commit checks where, if the changes is much larger than a certain threshold, it will warn the developer, and recommend them to break it into smaller chunk before committing.
Of course, it’s a recommendation, which I still allow the developer to proceed (I can make it a mandatory too if I like). It looks like below.
The Basic Knowledge of Git Hooks
When we git init a folder, it will create a .git folder. This will prepare itself to allow one to check in code etc.
At the same time, in the .git folder, it has a hooks folder, that consist of…

