Table of contents
This is how I commit my code.
I use Git as the Version Control System.
Yet, the following concepts is applicable for any version control system (vcs).
Design Principles:
- I want to use the same git workflow as much as possible, on different projects
- My pull requests should be easy to review and debug
- Have an easy way to setup my workflow and configure
- Ensure linting and security
- Should be able to make changes to my workflow
Use :
git diff --check
, identifies any possible white space errors and lists them for you. Add this as a git hook.Commit messages should be around 50 to 60 characters long, at max, like how one limits 120 characters per line when writing code
Make separate commits for separate changes
Use imperative tone, for your commit messages
- Example :
Make IndexController check for token
overMade changes to ensure IndexController checks for token
- Reason: Concise and the intent of the change is better understood right away
- Example :
Using git config i.e.
.gitconfig
file , to set the up required info. Such as :- GPG signature, Author info
- Reason: To make the commit more readable and secure. This depends on the use case
Ensure no sensitive info is checked-in as part of the commit. One should have an automated way, of checking this type of change.
- Reason: To minimise the security exposure and decrease the cost of setup going forward
- Tools to enforce the checks:
🏭 🏭 Automate as much as of the git workflow, as possible. Ensure the onboarding of this workflow is simple or at least not too cumbersome
- It's also scalable, when working in a team and easier to enforce rules
- I use Fig.io and aliases to use commands faster
You can make incremental changes over time to your workflow and setup.
- It's also scalable, when working in a team and easier to enforce rules
Sources I have used for reference:
For any feedback, you can tweet me at : @vaikuntj.
Cheers :). Have a great day 🎉🎉
Did you find this article valuable?
Support Jags by becoming a sponsor. Any amount is appreciated!